hle: kernel: k_auto_object: Move unregister with kernel to after Destroy.
- Destructor is no longer invoked, so our object counting was off.
This commit is contained in:
parent
d737652d08
commit
788bebb160
|
@ -89,9 +89,7 @@ public:
|
||||||
explicit KAutoObject(KernelCore& kernel_) : kernel(kernel_) {
|
explicit KAutoObject(KernelCore& kernel_) : kernel(kernel_) {
|
||||||
RegisterWithKernel();
|
RegisterWithKernel();
|
||||||
}
|
}
|
||||||
virtual ~KAutoObject() {
|
virtual ~KAutoObject() = default;
|
||||||
UnregisterWithKernel();
|
|
||||||
}
|
|
||||||
|
|
||||||
static KAutoObject* Create(KAutoObject* ptr);
|
static KAutoObject* Create(KAutoObject* ptr);
|
||||||
|
|
||||||
|
@ -168,6 +166,7 @@ public:
|
||||||
// If ref count hits zero, destroy the object.
|
// If ref count hits zero, destroy the object.
|
||||||
if (cur_ref_count - 1 == 0) {
|
if (cur_ref_count - 1 == 0) {
|
||||||
this->Destroy();
|
this->Destroy();
|
||||||
|
this->UnregisterWithKernel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue