Fix crash on database open from browser (#9939)

This commit is contained in:
Sami Vänttinen 2023-10-24 06:08:41 +03:00 committed by Jonathan White
parent c5312d63f2
commit 7f33868d14
3 changed files with 11 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2023 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -41,6 +41,7 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
, m_dbWidgetStateSync(new DatabaseWidgetStateSync(this))
, m_dbWidgetPendingLock(nullptr)
, m_databaseOpenDialog(new DatabaseOpenDialog(this))
, m_databaseOpenInProgress(false)
{
auto* tabBar = new QTabBar(this);
tabBar->setAcceptDrops(true);
@ -859,6 +860,7 @@ void DatabaseTabWidget::emitDatabaseLockChanged()
emit databaseLocked(dbWidget);
} else {
emit databaseUnlocked(dbWidget);
m_databaseOpenInProgress = false;
}
}
@ -891,6 +893,11 @@ void DatabaseTabWidget::performGlobalAutoType(const QString& search)
void DatabaseTabWidget::performBrowserUnlock()
{
if (m_databaseOpenInProgress) {
return;
}
m_databaseOpenInProgress = true;
auto dbWidget = currentDatabaseWidget();
if (dbWidget && dbWidget->isLocked()) {
unlockAnyDatabaseInDialog(DatabaseOpenDialog::Intent::Browser);