diff --git a/src/core/Group.cpp b/src/core/Group.cpp index f6e391859..763c5c0f9 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -40,19 +40,19 @@ Group::~Group() this->blockSignals(true); // Destroy entries and children manually so DeletedObjects can be added // to database. + QList entries = m_entries; + Q_FOREACH (Entry* entry, entries) { + entry->blockSignals(true); + delete entry; + } + + QList children = m_children; + Q_FOREACH (Group* group, children) { + group->blockSignals(true); + delete group; + } + if (m_db && m_parent) { - QList entries = m_entries; - Q_FOREACH (Entry* entry, entries) { - entry->blockSignals(true); - delete entry; - } - - QList children = m_children; - Q_FOREACH (Group* group, children) { - group->blockSignals(true); - delete group; - } - DeletedObject delGroup; delGroup.deletionTime = Tools::currentDateTimeUtc(); delGroup.uuid = m_uuid;