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