diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2020-12-18 14:48:08 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2020-12-21 14:30:02 +0300 |
commit | e53d181b9db141f1de8dd1068381f53a37224e34 (patch) | |
tree | 0ee45728afcf6f8a5267fa25ab2099eb8adc71dc | |
parent | df1c70965172b6b6104740f02001c433f439a882 (diff) |
Fix a possible crash with the remove all files dialog
-rw-r--r-- | changelog/unreleased/8314 | 6 | ||||
-rw-r--r-- | src/gui/folder.cpp | 1 | ||||
-rw-r--r-- | src/libsync/syncengine.cpp | 7 |
3 files changed, 11 insertions, 3 deletions
diff --git a/changelog/unreleased/8314 b/changelog/unreleased/8314 new file mode 100644 index 000000000..581cdc2b4 --- /dev/null +++ b/changelog/unreleased/8314 @@ -0,0 +1,6 @@ +Bugfix: Fix potential crashes with the remove all dialog + +We fixed a bug a dialog window belonging to a removed account could still +be visible. User action on that dialog would then cause a crash. + +https://github.com/owncloud/client/pull/8314 diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 6276629b0..6aa6b82aa 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -1223,6 +1223,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 3b331ed1f..8a1eb9609 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -732,10 +732,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(); |