mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 14:07:38 +03:00
Prevent crash when all entries are deleted from a group
* Fix #4093 - The first entry in the list is selected after deleting an entry * Prevents crashes due to dangling pointers held by the Entry Preview Widget when entries were deleted. * Improve GUI tests to ensure this new behavior occurs.
This commit is contained in:
parent
6cde2b83e8
commit
0d3eb047c7
4 changed files with 31 additions and 4 deletions
|
@ -154,6 +154,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
|
|||
m_shareLabel->setVisible(false);
|
||||
#endif
|
||||
|
||||
m_previewView->setObjectName("previewWidget");
|
||||
m_previewView->hide();
|
||||
m_previewSplitter->addWidget(m_entryView);
|
||||
m_previewSplitter->addWidget(m_previewView);
|
||||
|
@ -552,6 +553,14 @@ void DatabaseWidget::deleteEntries(QList<Entry*> selectedEntries)
|
|||
}
|
||||
|
||||
refreshSearch();
|
||||
|
||||
m_entryView->setFirstEntryActive();
|
||||
auto* currentEntry = currentSelectedEntry();
|
||||
if (currentEntry) {
|
||||
m_previewView->setEntry(currentEntry);
|
||||
} else {
|
||||
m_previewView->setGroup(groupView()->currentGroup());
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseWidget::confirmDeleteEntries(QList<Entry*> entries, bool permanent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue