fix: bind image fetch callback lambda to the parent object

Fixes a possible crash with the callback being called after the image
object was already deleted.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-12-12 23:51:22 -03:00
parent aaef448959
commit 756d933d1a
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -101,7 +101,7 @@ void VariableSizedImageObject::loadImage(QTextDocument* doc, const QUrl& source,
auto full_entry_path = entry->getFullPath(); auto full_entry_path = entry->getFullPath();
auto source_url = source; auto source_url = source;
connect(job, &NetJob::succeeded, [this, doc, full_entry_path, source_url, posInDocument] { connect(job, &NetJob::succeeded, this, [this, doc, full_entry_path, source_url, posInDocument] {
qDebug() << "Loaded resource at" << full_entry_path; qDebug() << "Loaded resource at" << full_entry_path;
// If we flushed, don't proceed. // If we flushed, don't proceed.