mirror of
https://github.com/hyprwm/hyprutils.git
synced 2024-12-22 22:29:49 +01:00
sharedptr: decrement on destruction (#1)
if we dont decrement the sharedptr on destruction any weakptr remaining will have an impl_ with a ref of 1 and upon destruction of the weakptr it wont delete the implentation because it thinks a shared pointer still exist.
This commit is contained in:
parent
0693f9398a
commit
1f4743a1f7
1 changed files with 1 additions and 7 deletions
|
@ -169,12 +169,6 @@ namespace Hyprutils {
|
||||||
}
|
}
|
||||||
|
|
||||||
~CSharedPointer() {
|
~CSharedPointer() {
|
||||||
// we do not decrement here,
|
|
||||||
// because we want to preserve the pointer
|
|
||||||
// in case this is the last owner.
|
|
||||||
if (impl_ && impl_->ref() == 1)
|
|
||||||
destroyImpl();
|
|
||||||
else
|
|
||||||
decrement();
|
decrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue