r18644 by jghali - fix memory leak detected by Visual Leak Detector
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 14 20:21:57 UTC 2013
Author: jghali
Date: Sat Dec 14 20:21:56 2013
New Revision: 18644
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18644
Log:
fix memory leak detected by Visual Leak Detector
Modified:
trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
trunk/Scribus/scribus/downloadmanager/scdlmgr.h
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18644&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp Sat Dec 14 20:21:56 2013
@@ -15,6 +15,13 @@
thread=new ScDLThread();
connect(thread, SIGNAL(received(const QString &)), this, SLOT(updateText(const QString&)));
connect(thread, SIGNAL(finished()), this, SIGNAL(finished()));
+}
+
+ScDLManager::~ScDLManager()
+{
+ // Per Qt doc, deleting a running thread will probably result in a program crash.
+ if (thread && !thread->isRunning())
+ delete thread;
}
void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& location)
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18644&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.h Sat Dec 14 20:21:56 2013
@@ -18,6 +18,7 @@
Q_OBJECT
public:
ScDLManager(QObject *parent = 0);
+ ~ScDLManager();
//TODO: Add download groups so different parts of Scribus can be downloading at the same time
void addURL(const QUrl &url, bool overwrite, const QString &location="");
More information about the scribus-commit
mailing list