mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-26 08:15:32 -04:00
Only disconnect m_db when it exists.
Previously we disconnected everyone when m_db == 0.
This commit is contained in:
parent
84d9d2ec47
commit
ca5dd373ed
1 changed files with 14 additions and 8 deletions
|
@ -323,7 +323,9 @@ void Group::removeEntry(Entry* entry)
|
||||||
Q_EMIT entryAboutToRemove(entry);
|
Q_EMIT entryAboutToRemove(entry);
|
||||||
|
|
||||||
entry->disconnect(this);
|
entry->disconnect(this);
|
||||||
|
if (m_db) {
|
||||||
entry->disconnect(m_db);
|
entry->disconnect(m_db);
|
||||||
|
}
|
||||||
m_entries.removeAll(entry);
|
m_entries.removeAll(entry);
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
Q_EMIT entryRemoved();
|
Q_EMIT entryRemoved();
|
||||||
|
@ -331,15 +333,19 @@ void Group::removeEntry(Entry* entry)
|
||||||
|
|
||||||
void Group::recSetDatabase(Database* db)
|
void Group::recSetDatabase(Database* db)
|
||||||
{
|
{
|
||||||
|
if (m_db) {
|
||||||
disconnect(SIGNAL(dataChanged(Group*)), m_db);
|
disconnect(SIGNAL(dataChanged(Group*)), m_db);
|
||||||
disconnect(SIGNAL(aboutToRemove(Group*)), m_db);
|
disconnect(SIGNAL(aboutToRemove(Group*)), m_db);
|
||||||
disconnect(SIGNAL(removed()), m_db);
|
disconnect(SIGNAL(removed()), m_db);
|
||||||
disconnect(SIGNAL(aboutToAdd(Group*,int)), m_db);
|
disconnect(SIGNAL(aboutToAdd(Group*,int)), m_db);
|
||||||
disconnect(SIGNAL(added()), m_db);
|
disconnect(SIGNAL(added()), m_db);
|
||||||
disconnect(SIGNAL(modified()), m_db);
|
disconnect(SIGNAL(modified()), m_db);
|
||||||
|
}
|
||||||
|
|
||||||
Q_FOREACH (Entry* entry, m_entries) {
|
Q_FOREACH (Entry* entry, m_entries) {
|
||||||
|
if (m_db) {
|
||||||
entry->disconnect(m_db);
|
entry->disconnect(m_db);
|
||||||
|
}
|
||||||
connect(entry, SIGNAL(modified()), db, SIGNAL(modified()));
|
connect(entry, SIGNAL(modified()), db, SIGNAL(modified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue