diff --git a/changelog/unreleased/8314 b/changelog/unreleased/8314 new file mode 100644 index 00000000000..581cdc2b471 --- /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 6276629b025..6aa6b82aab2 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 3b331ed1f60..8a1eb9609a0 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -732,10 +732,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();