Skip to content

Commit fc61f15

Browse files
committed
Fix crash when dialog is closed
The dialog was running in the wrong thread
1 parent 1c94c0f commit fc61f15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/kwalletrunner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ KWalletRunner::KWalletRunner(QObject *parent, const KPluginMetaData &data, const
1717
: KRunner::AbstractRunner(parent, data)
1818
#endif
1919
{
20+
Q_UNUSED(args)
2021
addSyntax(KRunner::RunnerSyntax(QStringLiteral("kwallet :q:"), QStringLiteral("Finds all KWallet entries matching :q:")));
2122
addSyntax(KRunner::RunnerSyntax(QStringLiteral("kwallet-add :q:"), QStringLiteral("Add an entry")));
2223

@@ -53,7 +54,6 @@ void KWalletRunner::match(KRunner::RunnerContext &context)
5354
for (const QString &folderName : wallet->folderList()) {
5455
wallet->setFolder(folderName);
5556
for (const QString &entryName : wallet->entryList()) {
56-
qWarning() << entryName;
5757
if (entryName.contains(searchTerm, Qt::CaseInsensitive)) {
5858
KRunner::QueryMatch match(this);
5959
#if KRUNNER_VERSION < QT_VERSION_CHECK(5, 113, 0)
@@ -130,7 +130,7 @@ void KWalletRunner::run(const KRunner::RunnerContext & /*context*/, const KRunne
130130
return;
131131
}
132132
}
133-
QTimer::singleShot(0, this, [data]() {
133+
QTimer::singleShot(0, QCoreApplication::instance(), [data]() {
134134
EditDialog addDialog;
135135
addDialog.init(data);
136136
addDialog.exec();
@@ -160,7 +160,7 @@ void KWalletRunner::run(const KRunner::RunnerContext & /*context*/, const KRunne
160160

161161
// Fallback case
162162
const auto *data = new EntryDialogData(match.subtext(), match.text());
163-
QTimer::singleShot(0, this, [data]() {
163+
QTimer::singleShot(0, QCoreApplication::instance(), [data]() {
164164
EntryDialog entryDialog;
165165
if (entryDialog.init(data)) {
166166
entryDialog.exec();

0 commit comments

Comments
 (0)