Fix an overall crash on safe connections management:

Let some time to check members destructions after connection destruction.
This commit is contained in:
Julien Wadel 2025-01-22 15:00:28 +01:00
parent 704431d63f
commit fe453b2f7d

View file

@ -74,11 +74,14 @@ public:
}
~SafeConnection() {
mLocker.lock();
if (mCore.mCountRef != 0 || mModel.mCountRef != 0)
lCritical() << "[SafeConnection] Destruction while still having references. CoreRef=" << mCore.mCountRef
<< "ModelRef=" << mModel.mCountRef;
mCore.reset();
mModel.reset();
if (mModel.mCountRef != 0)
QTimer::singleShot(1000, mModel.get(), []() {
lCritical() << "[SafeConnection] Destroyed 1s ago but a Model is still in memory";
});
if (mCore.mCountRef != 0)
QTimer::singleShot(1000, mCore.get(), []() {
lCritical() << "[SafeConnection] Destroyed 1s ago but a Core is still in memory";
});
mLocker.unlock();
}
SafeSharedPointer<A> mCore;