Commit 1be25dec authored by Willyanto Willyanto's avatar Willyanto Willyanto Committed by Nicolas Fella
Browse files

Fix crash when deleting activity from activity manager

When deleting activity from activity manager, the delete button is destroyed
while handling onClicked signal. This happens because
ActivitySettings.deleteActivity() is calling QMessageBox::question() that
waits for user confirmation.

Change deleteActivity call to use QMetaObject with QueuedConnection as the
connectivity type. This allows the delete button to be destroyed without
having to wait for user confirmation.

BUG: 426926
BUG: 427593
parent 5cbac50f
......@@ -58,12 +58,14 @@ void ActivitySettings::newActivity()
void ActivitySettings::deleteActivity(const QString &id)
{
KActivities::Info info(id);
QMetaObject::invokeMethod(this, [id] {
KActivities::Info info(id);
if (QMessageBox::question(nullptr, i18nc("@title:window", "Delete Activity"), i18n("Are you sure you want to delete '%1'?", info.name()))
== QMessageBox::Yes) {
KActivities::Controller().removeActivity(id);
}
if (QMessageBox::question(nullptr, i18nc("@title:window", "Delete Activity"), i18n("Are you sure you want to delete '%1'?", info.name()))
== QMessageBox::Yes) {
KActivities::Controller().removeActivity(id);
}
}, Qt::ConnectionType::QueuedConnection);
}
void ActivitySettings::configureActivities()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment