Prevent recursive loads using AutoOpen

* Fix #3334 - AutoOpen is now processed after the database widget is put into view mode to prevent infinite recursion of unlock attempts if two databases  auto open each other.
This commit is contained in:
Jonathan White authored and Janek Bevendorff committed 2019-11-09 00:53:40 +01:00
1 parent cb9929712c
commit 4edb623745
3 files changed
+11 -2

No files matched your search

+3 -1
View File
@@ -400,7 +400,6 @@ void DatabaseWidget::replaceDatabase(QSharedPointer<Database> db)
m_db = std::move(db);
connectDatabaseSignals();
m_groupView->changeDatabase(m_db);
processAutoOpen();
// Restore the new parent group pointer, if not found default to the root group
// this prevents data loss when merging a database while creating a new entry
@@ -946,6 +945,7 @@ void DatabaseWidget::loadDatabase(bool accepted)
if (accepted) {
replaceDatabase(openWidget->database());
switchToMainView();
processAutoOpen();
m_saveAttempts = 0;
emit databaseUnlocked();
if (config()->get("MinimizeAfterUnlock").toBool()) {
@@ -1032,6 +1032,7 @@ void DatabaseWidget::unlockDatabase(bool accepted)
m_entryBeforeLock = QUuid();
switchToMainView();
processAutoOpen();
emit databaseUnlocked();
if (senderDialog && senderDialog->intent() == DatabaseOpenDialog::Intent::AutoType) {
@@ -1468,6 +1469,7 @@ void DatabaseWidget::reloadDatabaseFile()
}
replaceDatabase(db);
processAutoOpen();
restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload);
m_blockAutoSave = false;
} else {