diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 55a70b7ab..31ef9c780 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -889,8 +889,17 @@ void DatabaseWidget::clearLastGroup(Group* group) void DatabaseWidget::lock() { Q_ASSERT(currentMode() != DatabaseWidget::LockedMode); + if (isInSearchMode()) { + closeSearch(); + } + + if (m_groupView->currentGroup()) { + m_groupBeforeLock = m_groupView->currentGroup()->uuid(); + } + else { + m_groupBeforeLock = m_db->rootGroup()->uuid(); + } - m_groupBeforeLock = m_groupView->currentGroup()->uuid(); clearAllWidgets(); m_unlockDatabaseWidget->load(m_filename); setCurrentWidget(m_unlockDatabaseWidget);