mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 17:05:23 -05:00
Fix crash in KeeShare when importing deleted share
* Fix #4895 - when KeeShare imports a database it performs a merge operation. If that share was deleted from another identical database (ie, same base group UUID), then the group would be deleted in the middle of reinit causing a crash. This fix moves the group into a QPointer catching the delete operation.
This commit is contained in:
parent
1ed5cc9898
commit
dc57025218
@ -66,7 +66,7 @@ void ShareObserver::deinitialize()
|
||||
|
||||
void ShareObserver::reinitialize()
|
||||
{
|
||||
QList<QPair<Group*, KeeShareSettings::Reference>> shares;
|
||||
QList<QPair<QPointer<Group>, KeeShareSettings::Reference>> shares;
|
||||
for (Group* group : m_db->rootGroup()->groupsRecursive(true)) {
|
||||
auto oldReference = m_groupToReference.value(group);
|
||||
auto newReference = KeeShare::referenceOf(group);
|
||||
@ -97,6 +97,10 @@ void ShareObserver::reinitialize()
|
||||
for (const auto& share : shares) {
|
||||
auto group = share.first;
|
||||
auto& reference = share.second;
|
||||
// Check group validity, it may have been deleted by a merge action
|
||||
if (!group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!reference.path.isEmpty() && reference.type != KeeShareSettings::Inactive) {
|
||||
const auto newResolvedPath = resolvePath(reference.path, m_db);
|
||||
|
Loading…
x
Reference in New Issue
Block a user