Properly block modified signal during Database destruction (#6438)

fixes #6393
This commit is contained in:
Aetf
2021-05-27 21:50:15 -04:00
committed by GitHub
parent 66c3026cf5
commit 81a66c439c
34 changed files with 370 additions and 179 deletions

View File

@@ -23,7 +23,7 @@
#include <QStringList>
EntryAttachments::EntryAttachments(QObject* parent)
: QObject(parent)
: ModifiableObject(parent)
{
}
@@ -49,7 +49,7 @@ QByteArray EntryAttachments::value(const QString& key) const
void EntryAttachments::set(const QString& key, const QByteArray& value)
{
bool emitModified = false;
bool shouldEmitModified = false;
bool addAttachment = !m_attachments.contains(key);
if (addAttachment) {
@@ -58,7 +58,7 @@ void EntryAttachments::set(const QString& key, const QByteArray& value)
if (addAttachment || m_attachments.value(key) != value) {
m_attachments.insert(key, value);
emitModified = true;
shouldEmitModified = true;
}
if (addAttachment) {
@@ -67,8 +67,8 @@ void EntryAttachments::set(const QString& key, const QByteArray& value)
emit keyModified(key);
}
if (emitModified) {
emit entryAttachmentsModified();
if (shouldEmitModified) {
emitModified();
}
}
@@ -84,7 +84,7 @@ void EntryAttachments::remove(const QString& key)
m_attachments.remove(key);
emit removed(key);
emit entryAttachmentsModified();
emitModified();
}
void EntryAttachments::remove(const QStringList& keys)
@@ -108,7 +108,7 @@ void EntryAttachments::remove(const QStringList& keys)
}
if (isModified) {
emit entryAttachmentsModified();
emitModified();
}
}
@@ -135,7 +135,7 @@ void EntryAttachments::clear()
m_attachments.clear();
emit reset();
emit entryAttachmentsModified();
emitModified();
}
void EntryAttachments::copyDataFrom(const EntryAttachments* other)
@@ -146,7 +146,7 @@ void EntryAttachments::copyDataFrom(const EntryAttachments* other)
m_attachments = other->m_attachments;
emit reset();
emit entryAttachmentsModified();
emitModified();
}
}