[kmail2] [Bug 358116] messageviewer leaks temporary files with mail parts in it

Sandro Knauß via KDE Bugzilla bugzilla_noreply at kde.org
Fri Jan 29 10:17:15 GMT 2016


https://bugs.kde.org/show_bug.cgi?id=358116

--- Comment #6 from Sandro Knauß <sknauss at kde.org> ---
Well I can reproduce this behaviour with a simple testcase.  This one fails:
    QString path;
    {
        NodeHelper helper;
        path = helper.createTempDir(QStringLiteral("foo"));
        QVERIFY(QDir(path).exists());
    }
    QEventLoop loop;
    QTimer::singleShot(0, &loop, &QEventLoop::quit);
    loop.exec();
    QVERIFY(!QDir(path).exists());

if I change the singleShot to something like 11000 (11secs) if passes.

The problem here is that if the NodeHelper instance is deleted the tempfiles
are deleted also only 10secs after the application and not directly with the
deletion of NodeHelper. I see no need to wait 10secs when the object is already
deleted.

NodeHelper::~NodeHelper()
{
    //Don't delete it it will delete in class with a deleteLater;
    if (mAttachmentFilesDir) {
        mAttachmentFilesDir->removeTempFiles();
        mAttachmentFilesDir = 0;
    }
}

void AttachmentTemporaryFilesDirs::removeTempFiles()
{
    QTimer::singleShot(d->mDelayRemoveAll, this,
&AttachmentTemporaryFilesDirs::slotRemoveTempFiles);
}

^^ d->mDelayRemoveAll is 10secs.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kdepim-bugs mailing list