Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a possible crash with the remove all files dialog #8314

Merged
merged 1 commit into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/8314
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, std::functio
}
setSyncPaused(oldPaused);
});
connect(this, &Folder::destroyed, msgBox, &QMessageBox::deleteLater);
msgBox->open();
}

Expand Down
7 changes: 4 additions & 3 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down