Kernel: Don't re-assign object's handle when duplicating one

This commit is contained in:
Yuri Kunde Schlesner 2014-12-31 09:20:48 -02:00
parent 08096a5015
commit ff3eee27da
2 changed files with 3 additions and 2 deletions

View file

@ -39,7 +39,8 @@ ResultVal<Handle> HandleTable::Create(std::shared_ptr<Object> obj) {
if (next_generation >= (1 << 15)) next_generation = 1;
Handle handle = generation | (slot << 15);
obj->handle = handle;
if (obj->handle == INVALID_HANDLE)
obj->handle = handle;
generations[slot] = generation;
objects[slot] = std::move(obj);

View file

@ -53,7 +53,7 @@ class HandleTable;
class Object : NonCopyable, public std::enable_shared_from_this<Object> {
friend class HandleTable;
u32 handle;
u32 handle = INVALID_HANDLE;
public:
virtual ~Object() {}
Handle GetHandle() const { return handle; }