mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-24 23:09:44 -05:00
Fix crash when deleting items in recycle bin while searching (#8117)
* Fix #8099 * Clean up code that connects groups to the entry view. Instead of connecting ALL groups from ALL databases, we only need to connect the groups that entries actually belong to. This solves the bug and also reduces overhead.
This commit is contained in:
parent
d181f80c8c
commit
eaa363d8c0
@ -85,25 +85,13 @@ void EntryModel::setEntries(const QList<Entry*>& entries)
|
||||
m_entries = entries;
|
||||
m_orgEntries = entries;
|
||||
|
||||
QSet<Database*> databases;
|
||||
|
||||
for (Entry* entry : asConst(m_entries)) {
|
||||
databases.insert(entry->group()->database());
|
||||
}
|
||||
|
||||
for (Database* db : asConst(databases)) {
|
||||
Q_ASSERT(db);
|
||||
const QList<Group*> groupList = db->rootGroup()->groupsRecursive(true);
|
||||
for (const Group* group : groupList) {
|
||||
m_allGroups.append(group);
|
||||
}
|
||||
|
||||
if (db->metadata()->recycleBin()) {
|
||||
m_allGroups.removeOne(db->metadata()->recycleBin());
|
||||
for (const auto entry : asConst(m_entries)) {
|
||||
if (entry->group()) {
|
||||
m_allGroups.insert(entry->group());
|
||||
}
|
||||
}
|
||||
|
||||
for (const Group* group : asConst(m_allGroups)) {
|
||||
for (const auto group : m_allGroups) {
|
||||
makeConnections(group);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QPixmap>
|
||||
#include <QSet>
|
||||
|
||||
#include "core/Config.h"
|
||||
|
||||
@ -87,7 +88,7 @@ private:
|
||||
Group* m_group;
|
||||
QList<Entry*> m_entries;
|
||||
QList<Entry*> m_orgEntries;
|
||||
QList<const Group*> m_allGroups;
|
||||
QSet<const Group*> m_allGroups;
|
||||
|
||||
const QString HiddenContentDisplay;
|
||||
const Qt::DateFormat DateFormat;
|
||||
|
Loading…
Reference in New Issue
Block a user