Always reset Auto-Type state on finished signal

There were a couple code paths that did not reset the state appropriately and could cause undefined behavior in the auto-type processing.
This commit is contained in:
Jonathan White 2024-12-27 17:10:17 -05:00
parent 2ea656bc27
commit 41b6247178
2 changed files with 2 additions and 6 deletions

View File

@ -153,6 +153,7 @@ AutoType::AutoType(QObject* parent, bool test)
#endif
}
connect(this, SIGNAL(autotypeFinished()), SLOT(resetAutoTypeState()));
connect(qApp, SIGNAL(aboutToQuit()), SLOT(unloadPlugin()));
}
@ -353,7 +354,6 @@ void AutoType::executeAutoTypeActions(const Entry* entry,
}
}
resetAutoTypeState();
m_inAutoType.unlock();
emit autotypeFinished();
}
@ -488,11 +488,9 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
m_windowForGlobal,
virtualMode ? AutoTypeExecutor::Mode::VIRTUAL
: AutoTypeExecutor::Mode::NORMAL);
resetAutoTypeState();
});
connect(selectDialog, &QDialog::rejected, this, [this] {
restoreWindowState();
resetAutoTypeState();
emit autotypeFinished();
});
@ -506,10 +504,8 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
} else if (!matchList.isEmpty()) {
// Only one match and not asking, do it!
executeAutoTypeActions(matchList.first().first, matchList.first().second, m_windowForGlobal);
resetAutoTypeState();
} else {
// We should never get here
resetAutoTypeState();
emit autotypeFinished();
}
}

View File

@ -66,6 +66,7 @@ signals:
private slots:
void startGlobalAutoType(const QString& search);
void unloadPlugin();
void resetAutoTypeState();
private:
enum WindowState
@ -83,7 +84,6 @@ private:
WId window = 0,
AutoTypeExecutor::Mode mode = AutoTypeExecutor::Mode::NORMAL);
void restoreWindowState();
void resetAutoTypeState();
static QList<QSharedPointer<AutoTypeAction>>
parseSequence(const QString& entrySequence, const Entry* entry, QString& error, bool syntaxOnly = false);