mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-25 22:16:01 -05:00
Fix QTimer cannot be stopped from another thread warning
This commit is contained in:
parent
9a96124040
commit
30c2e39e70
@ -431,7 +431,7 @@ void Database::releaseData()
|
|||||||
|
|
||||||
setEmitModified(false);
|
setEmitModified(false);
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
m_modifiedTimer.stop();
|
stopModifiedTimer();
|
||||||
|
|
||||||
s_uuidMap.remove(m_uuid);
|
s_uuidMap.remove(m_uuid);
|
||||||
m_uuid = QUuid();
|
m_uuid = QUuid();
|
||||||
@ -842,7 +842,7 @@ void Database::emptyRecycleBin()
|
|||||||
void Database::setEmitModified(bool value)
|
void Database::setEmitModified(bool value)
|
||||||
{
|
{
|
||||||
if (m_emitModified && !value) {
|
if (m_emitModified && !value) {
|
||||||
m_modifiedTimer.stop();
|
stopModifiedTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_emitModified = value;
|
m_emitModified = value;
|
||||||
@ -863,7 +863,7 @@ void Database::markAsModified()
|
|||||||
m_modified = true;
|
m_modified = true;
|
||||||
if (m_emitModified && !m_modifiedTimer.isActive()) {
|
if (m_emitModified && !m_modifiedTimer.isActive()) {
|
||||||
// Small time delay prevents numerous consecutive saves due to repeated signals
|
// Small time delay prevents numerous consecutive saves due to repeated signals
|
||||||
m_modifiedTimer.start(150);
|
startModifiedTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ void Database::markAsClean()
|
|||||||
{
|
{
|
||||||
bool emitSignal = m_modified;
|
bool emitSignal = m_modified;
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
m_modifiedTimer.stop();
|
stopModifiedTimer();
|
||||||
m_hasNonDataChange = false;
|
m_hasNonDataChange = false;
|
||||||
if (emitSignal) {
|
if (emitSignal) {
|
||||||
emit databaseSaved();
|
emit databaseSaved();
|
||||||
@ -927,3 +927,13 @@ bool Database::changeKdf(const QSharedPointer<Kdf>& kdf)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database::startModifiedTimer()
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(&m_modifiedTimer, "start", Q_ARG(int, 150));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Database::stopModifiedTimer()
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(&m_modifiedTimer, "stop");
|
||||||
|
}
|
||||||
|
@ -202,6 +202,8 @@ private:
|
|||||||
bool backupDatabase(const QString& filePath);
|
bool backupDatabase(const QString& filePath);
|
||||||
bool restoreDatabase(const QString& filePath);
|
bool restoreDatabase(const QString& filePath);
|
||||||
bool performSave(const QString& filePath, QString* error, bool atomic, bool backup);
|
bool performSave(const QString& filePath, QString* error, bool atomic, bool backup);
|
||||||
|
void startModifiedTimer();
|
||||||
|
void stopModifiedTimer();
|
||||||
|
|
||||||
QPointer<Metadata> const m_metadata;
|
QPointer<Metadata> const m_metadata;
|
||||||
DatabaseData m_data;
|
DatabaseData m_data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user