[pim/kdepim-addons] kaddressbook/plugins/sendvcards: Delete mAttachmentTemporary

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 700e1ec4ff863f02820cba65e6f0dd7d0145b9ba by Volker Krause.
Committed on 17/08/2026 at 15:33.
Pushed by vkrause into branch 'master'.

Delete mAttachmentTemporary

Its destructor doesn't do anything, but it can still have pending activity
in queued connections internally that we could prevent with an immediate
deletion, which is presumably why this was explicitly not deleted before.

Using a deferred deletion avoids this though, and fixes LSAN failures in
the corresponding unit tests.

M  +5    -2    kaddressbook/plugins/sendvcards/sendvcardsjob.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/700e1ec4ff863f02820cba65e6f0dd7d0145b9ba

diff --git a/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp b/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
index 2f81bc375..deece70b5 100644
--- a/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
+++ b/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
@@ -30,8 +30,11 @@ SendVcardsJob::~SendVcardsJob()
 {
     delete mTempDir;
     mTempDir = nullptr;
-    // Don't delete it.
-    mAttachmentTemporary = nullptr;
+    // Don't delete it immediately, it might still have pending work in queued connections
+    if (mAttachmentTemporary) {
+        mAttachmentTemporary->deleteLater();
+        mAttachmentTemporary = nullptr;
+    }
 }
 
 QString SendVcardsJob::createUniqueAttachmentName(const QString &contactRealName, const QStringList &existingVcard)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.