mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
SafeConnection premature destruction in ParticipantDeviceList and ParticipantList (cherry pick from quanta)
This commit is contained in:
parent
e4531b072d
commit
3013218181
3 changed files with 15 additions and 11 deletions
|
|
@ -96,9 +96,9 @@ void ParticipantDeviceList::setConferenceModel(const std::shared_ptr<ConferenceM
|
|||
mConferenceModel = conferenceModel;
|
||||
lDebug() << log().arg("Set Conference %1").arg((quint64)mConferenceModel.get());
|
||||
if (mConferenceModelConnection->mCore.lock()) { // Ensure 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();
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ void ParticipantList::setConferenceModel(const std::shared_ptr<ConferenceModel>
|
|||
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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue