mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-02 01:25:13 -05:00
Stop suppressing signals in Group dtor.
That way we emit entry/group removed signals. Move cleanupParent() call to the bottom so we maintain the group tree structure for objects that connect to those signals.
This commit is contained in:
parent
72d17c045f
commit
c7593a3047
@ -36,19 +36,15 @@ Group::Group()
|
|||||||
|
|
||||||
Group::~Group()
|
Group::~Group()
|
||||||
{
|
{
|
||||||
cleanupParent();
|
|
||||||
this->blockSignals(true);
|
|
||||||
// Destroy entries and children manually so DeletedObjects can be added
|
// Destroy entries and children manually so DeletedObjects can be added
|
||||||
// to database.
|
// to database.
|
||||||
QList<Entry*> entries = m_entries;
|
QList<Entry*> entries = m_entries;
|
||||||
Q_FOREACH (Entry* entry, entries) {
|
Q_FOREACH (Entry* entry, entries) {
|
||||||
entry->blockSignals(true);
|
|
||||||
delete entry;
|
delete entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Group*> children = m_children;
|
QList<Group*> children = m_children;
|
||||||
Q_FOREACH (Group* group, children) {
|
Q_FOREACH (Group* group, children) {
|
||||||
group->blockSignals(true);
|
|
||||||
delete group;
|
delete group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +54,8 @@ Group::~Group()
|
|||||||
delGroup.uuid = m_uuid;
|
delGroup.uuid = m_uuid;
|
||||||
m_db->addDeletedObject(delGroup);
|
m_db->addDeletedObject(delGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanupParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Group::createRecycleBin()
|
Group* Group::createRecycleBin()
|
||||||
|
@ -262,8 +262,8 @@ void TestGroup::testDeleteSignals()
|
|||||||
|
|
||||||
delete groupChild;
|
delete groupChild;
|
||||||
QVERIFY(groupRoot->children().isEmpty());
|
QVERIFY(groupRoot->children().isEmpty());
|
||||||
QCOMPARE(spyAboutToRemove.count(), 1);
|
QCOMPARE(spyAboutToRemove.count(), 2);
|
||||||
QCOMPARE(spyRemoved.count(), 1);
|
QCOMPARE(spyRemoved.count(), 2);
|
||||||
delete db;
|
delete db;
|
||||||
|
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ void TestGroup::testDeleteSignals()
|
|||||||
QSignalSpy spyEntryRemoved2(group2, SIGNAL(entryRemoved(Entry*)));
|
QSignalSpy spyEntryRemoved2(group2, SIGNAL(entryRemoved(Entry*)));
|
||||||
|
|
||||||
delete group2;
|
delete group2;
|
||||||
QCOMPARE(spyEntryAboutToRemove2.count(), 0);
|
QCOMPARE(spyEntryAboutToRemove2.count(), 1);
|
||||||
QCOMPARE(spyEntryRemoved2.count(), 0);
|
QCOMPARE(spyEntryRemoved2.count(), 1);
|
||||||
delete db2;
|
delete db2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ void TestGroupModel::test()
|
|||||||
delete group12;
|
delete group12;
|
||||||
QCOMPARE(spyAboutToAdd.count(), 1);
|
QCOMPARE(spyAboutToAdd.count(), 1);
|
||||||
QCOMPARE(spyAdded.count(), 1);
|
QCOMPARE(spyAdded.count(), 1);
|
||||||
QCOMPARE(spyAboutToRemove.count(), 1);
|
QCOMPARE(spyAboutToRemove.count(), 2);
|
||||||
QCOMPARE(spyRemoved.count(), 1);
|
QCOMPARE(spyRemoved.count(), 2);
|
||||||
QCOMPARE(spyAboutToMove.count(), 3);
|
QCOMPARE(spyAboutToMove.count(), 3);
|
||||||
QCOMPARE(spyMoved.count(), 3);
|
QCOMPARE(spyMoved.count(), 3);
|
||||||
QVERIFY(!index12.isValid());
|
QVERIFY(!index12.isValid());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user