Fix a possible crash with the remove all files dialog

This commit is contained in:
Hannah von Reth 2020-12-18 12:48:08 +01:00 committed by Kevin Ottens
parent da3ff631ef
commit 09cc988026
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 5 additions and 3 deletions

View file

@ -1260,6 +1260,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, std::functio
}
setSyncPaused(oldPaused);
});
connect(this, &Folder::destroyed, msgBox, &QMessageBox::deleteLater);
msgBox->open();
}

View file

@ -737,10 +737,11 @@ void SyncEngine::slotDiscoveryFinished()
}
QPointer<QObject> guard = new QObject();
auto callback = [this, finish, guard](bool cancel) -> void {
QPointer<QObject> self = this;
auto callback = [this, self, finish, guard](bool cancel) -> void {
// use a guard to ensure its only called once...
if (!guard)
{
// qpointer to self to ensure we still exist
if (!guard || !self) {
return;
}
guard->deleteLater();