mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 08:18:08 +00:00
fix(SipAddressesModel): avoid a crash when a sip address observer is destroyed
This commit is contained in:
parent
306c187774
commit
2de3d84029
1 changed files with 4 additions and 4 deletions
|
|
@ -116,10 +116,10 @@ SipAddressObserver *SipAddressesModel::getSipAddressObserver (const QString &sip
|
|||
|
||||
mObservers.insert(cleanedSipAddress, model);
|
||||
QObject::connect(
|
||||
model, &SipAddressObserver::destroyed, this, [this, model]() {
|
||||
const QString sipAddress = cleanSipAddress(model->getSipAddress());
|
||||
if (mObservers.remove(sipAddress, model) == 0)
|
||||
qWarning() << QStringLiteral("Unable to remove sip address `%1` from observers.").arg(sipAddress);
|
||||
model, &SipAddressObserver::destroyed, this, [this, model, cleanedSipAddress]() {
|
||||
// Do not use `model` methods here. `model` is partially destroyed here!
|
||||
if (mObservers.remove(cleanedSipAddress, model) == 0)
|
||||
qWarning() << QStringLiteral("Unable to remove sip address `%1` from observers.").arg(cleanedSipAddress);
|
||||
});
|
||||
|
||||
return model;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue