From d751de7341029dc8335a6766dcdf5c8dc047f0bc Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 31 Dec 2014 09:20:48 -0200 Subject: Kernel: Don't re-assign object's handle when duplicating one --- src/core/hle/kernel/kernel.cpp | 3 ++- src/core/hle/kernel/kernel.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index a1bc6c5d8..7d40dcbee 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -44,7 +44,8 @@ ResultVal HandleTable::Create(Object* obj) { objects[slot] = obj; Handle handle = generation | (slot << 15); - obj->handle = handle; + if (obj->handle == INVALID_HANDLE) + obj->handle = handle; return MakeResult(handle); } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 31d80c7ac..a35055724 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -52,7 +52,7 @@ class HandleTable; class Object : NonCopyable { friend class HandleTable; - u32 handle; + u32 handle = INVALID_HANDLE; public: virtual ~Object() {} Handle GetHandle() const { return handle; } -- cgit v1.2.3