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:
Tom Englund 2024-06-13 11:29:50 +02:00 committed by GitHub
parent 0693f9398a
commit 1f4743a1f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -169,12 +169,6 @@ 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();
}