mirror of
https://github.com/hyprwm/hyprutils.git
synced 2024-11-17 01:25:58 +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,13 +169,7 @@ namespace Hyprutils {
|
|||
}
|
||||
|
||||
~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();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
|
|
Loading…
Reference in a new issue