summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-04-06 17:41:11 -0700
committerbunnei <bunneidev@gmail.com>2022-04-08 14:11:40 -0700
commit788bebb160e0f6002a225eac365252a493a92f77 (patch)
treeaece2571b09bf61c05388508b59dcaf2ed846c8f /src
parentd737652d08ad40ff235772f0ff3daaa9a4478cef (diff)
hle: kernel: k_auto_object: Move unregister with kernel to after Destroy.
- Destructor is no longer invoked, so our object counting was off.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_auto_object.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h
index 05779f2d5..c097373a8 100644
--- a/src/core/hle/kernel/k_auto_object.h
+++ b/src/core/hle/kernel/k_auto_object.h
@@ -89,9 +89,7 @@ public:
explicit KAutoObject(KernelCore& kernel_) : kernel(kernel_) {
RegisterWithKernel();
}
- virtual ~KAutoObject() {
- UnregisterWithKernel();
- }
+ virtual ~KAutoObject() = default;
static KAutoObject* Create(KAutoObject* ptr);
@@ -168,6 +166,7 @@ public:
// If ref count hits zero, destroy the object.
if (cur_ref_count - 1 == 0) {
this->Destroy();
+ this->UnregisterWithKernel();
}
}