Fix database merge crash when fdosecrets is enabled (#10136)

* Entry: re-parent before adding to new group

Adding the Entry to the Group will emit signals about the action.
Present the object with the correct parent already.

* fdosecrets: Item::Create() can fail

If an entry cannot be registered on DBus, Item::Create() will return a
nullptr. Basically, this can only happen if there is already an item
with the same UUID in the collection. The only viable option here is to
ignore the new entry.

* Merger: prevent duplicate entry when merging histories

If the source entry is newer, a copy of the entry is made. But before 
moving the merged entry to the target group, it must be removed. 
Otherwise there will be briefly two entries with the same UUID
in the same group/database.

Even though this is only the case during the transaction, it can still
be observed because the operations emit signals. A notable problem is
the fdosecrets feature that relies on the uniqueness of the UUID or will
otherwise run into problems because the UUID is used as part of the DBus
path.
This commit is contained in:
Jan Klötzke authored and GitHub committed 2024-01-02 07:17:25 -05:00
1 parent fefab7064a
commit a8cfefe6c8
4 files changed
+15 -8

No files matched your search

+2 -2
View File
@@ -1277,11 +1277,11 @@ void Entry::setGroup(Group* group, bool trackPrevious)
}
}
QObject::setParent(group);
m_group = group;
group->addEntry(this);
QObject::setParent(group);
if (m_updateTimeinfo) {
m_data.timeInfo.setLocationChanged(Clock::currentDateTimeUtc());
}