From: Hannah von Reth Date: Fri, 18 Dec 2020 11:48:08 +0000 (+0100) Subject: Fix a possible crash with the remove all files dialog X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~446^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=09cc988026f37f9f9a525437c418c02207f5493b;p=nextcloud-desktop.git Fix a possible crash with the remove all files dialog --- diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 742981195..4f8c1e152 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1260,6 +1260,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, std::functio } setSyncPaused(oldPaused); }); + connect(this, &Folder::destroyed, msgBox, &QMessageBox::deleteLater); msgBox->open(); } diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 7d6ae74d3..89d4057fc 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -737,10 +737,11 @@ void SyncEngine::slotDiscoveryFinished() } QPointer guard = new QObject(); - auto callback = [this, finish, guard](bool cancel) -> void { + QPointer 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();