mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Move database open to async task
* Wrap key transformation in AsyncTask when reading a database. Significantly reduces user interface lockup. * Replace root group with new group instead of deleting the pointer (fulfills member validity promise).
This commit is contained in:
parent
91c6e436b3
commit
a8c02fdc3c
@ -415,27 +415,26 @@ void Database::releaseData()
|
||||
// Prevent data release while saving
|
||||
QMutexLocker locker(&m_saveMutex);
|
||||
|
||||
s_uuidMap.remove(m_uuid);
|
||||
m_uuid = QUuid();
|
||||
|
||||
if (m_modified) {
|
||||
emit databaseDiscarded();
|
||||
}
|
||||
|
||||
setEmitModified(false);
|
||||
m_modified = false;
|
||||
m_modifiedTimer.stop();
|
||||
|
||||
s_uuidMap.remove(m_uuid);
|
||||
m_uuid = QUuid();
|
||||
|
||||
m_data.clear();
|
||||
m_metadata->clear();
|
||||
|
||||
if (m_rootGroup && m_rootGroup->parent() == this) {
|
||||
delete m_rootGroup;
|
||||
}
|
||||
setRootGroup(new Group());
|
||||
|
||||
m_fileWatcher->stop();
|
||||
|
||||
m_deletedObjects.clear();
|
||||
m_commonUsernames.clear();
|
||||
|
||||
m_modified = false;
|
||||
m_modifiedTimer.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -967,14 +967,7 @@ void Group::removeEntry(Entry* entry)
|
||||
void Group::connectDatabaseSignalsRecursive(Database* db)
|
||||
{
|
||||
if (m_db) {
|
||||
disconnect(SIGNAL(groupDataChanged(Group*)), m_db);
|
||||
disconnect(SIGNAL(groupAboutToRemove(Group*)), m_db);
|
||||
disconnect(SIGNAL(groupRemoved()), m_db);
|
||||
disconnect(SIGNAL(groupAboutToAdd(Group*, int)), m_db);
|
||||
disconnect(SIGNAL(groupAdded()), m_db);
|
||||
disconnect(SIGNAL(aboutToMove(Group*, Group*, int)), m_db);
|
||||
disconnect(SIGNAL(groupMoved()), m_db);
|
||||
disconnect(SIGNAL(groupModified()), m_db);
|
||||
disconnect(m_db);
|
||||
}
|
||||
|
||||
for (Entry* entry : asConst(m_entries)) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "Kdbx3Reader.h"
|
||||
|
||||
#include "core/AsyncTask.h"
|
||||
#include "core/Endian.h"
|
||||
#include "core/Group.h"
|
||||
#include "crypto/CryptoHash.h"
|
||||
@ -47,7 +48,8 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!db->setKey(key, false)) {
|
||||
bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false); });
|
||||
if (!ok) {
|
||||
raiseError(tr("Unable to calculate master key"));
|
||||
return false;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <QBuffer>
|
||||
|
||||
#include "core/AsyncTask.h"
|
||||
#include "core/Endian.h"
|
||||
#include "core/Group.h"
|
||||
#include "crypto/CryptoHash.h"
|
||||
@ -47,7 +48,8 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!db->setKey(key, false, false)) {
|
||||
bool ok = AsyncTask::runAndWaitForFuture([&] { return db->setKey(key, false, false); });
|
||||
if (!ok) {
|
||||
raiseError(tr("Unable to calculate master key"));
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user