diff --git a/Linphone/core/participant/ParticipantDeviceList.cpp b/Linphone/core/participant/ParticipantDeviceList.cpp index d92554d0d..23f88a087 100644 --- a/Linphone/core/participant/ParticipantDeviceList.cpp +++ b/Linphone/core/participant/ParticipantDeviceList.cpp @@ -95,10 +95,10 @@ void ParticipantDeviceList::setConferenceModel(const std::shared_ptrmCore.lock()) { // Ensure to get myself - auto oldConnect = mConferenceModelConnection->mCore; // Setself rebuild safepointer - setSelf(mConferenceModelConnection->mCore.mQData); // reset connections - oldConnect.unlock(); + if (mConferenceModelConnection->mCore.lock()) { // Ensure to get myself + auto me = mConferenceModelConnection->mCore.mQData; // Save shared pointer before unlock + mConferenceModelConnection->mCore.unlock(); // Unlock before destroying old connection + setSelf(me); // reset connections } beginResetModel(); mList.clear(); diff --git a/Linphone/core/participant/ParticipantList.cpp b/Linphone/core/participant/ParticipantList.cpp index b7ba208aa..a1399082c 100644 --- a/Linphone/core/participant/ParticipantList.cpp +++ b/Linphone/core/participant/ParticipantList.cpp @@ -105,9 +105,9 @@ void ParticipantList::setConferenceModel(const std::shared_ptr mConferenceModel = conferenceModel; lDebug() << "[ParticipantList] : set Conference " << mConferenceModel.get(); if (mConferenceModelConnection && mConferenceModelConnection->mCore.lock()) { // Unsure to get myself - auto oldConnect = mConferenceModelConnection->mCore; // Setself rebuild safepointer - setSelf(mConferenceModelConnection->mCore.mQData); // reset connections - oldConnect.unlock(); + auto me = mConferenceModelConnection->mCore.mQData; // Save shared pointer before unlock + mConferenceModelConnection->mCore.unlock(); // Unlock before destroying old connection + setSelf(me); // reset connections } beginResetModel(); mList.clear(); diff --git a/Linphone/tool/thread/SafeConnection.hpp b/Linphone/tool/thread/SafeConnection.hpp index e6b28e17f..86b333575 100644 --- a/Linphone/tool/thread/SafeConnection.hpp +++ b/Linphone/tool/thread/SafeConnection.hpp @@ -74,13 +74,17 @@ protected: } ~SafeConnection() { mLocker.lock(); + auto coreType = QString(typeid(A).name()); + auto modelType = QString(typeid(B).name()); if (mModel.mCountRef != 0) - QTimer::singleShot(1000, mModel.get(), []() { - lCritical() << "[SafeConnection] Destroyed 1s ago but a Model is still in memory"; + QTimer::singleShot(1000, mModel.get(), [coreType, modelType]() { + lCritical() << "[SafeConnection] Destroyed 1s ago but a Model is still in memory." + << "Core:" << coreType << "Model:" << modelType; }); if (mCore.mCountRef != 0) - QTimer::singleShot(1000, mCore.get(), []() { - lCritical() << "[SafeConnection] Destroyed 1s ago but a Core is still in memory"; + QTimer::singleShot(1000, mCore.get(), [coreType, modelType]() { + lCritical() << "[SafeConnection] Destroyed 1s ago but a Core is still in memory." + << "Core:" << coreType << "Model:" << modelType; }); mLocker.unlock(); }