r18646 by jghali - divide by 3 the number of leaks reported by Visual Leak Detector by exiting more cleanly from scribus process

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 14 23:07:44 UTC 2013


Author: jghali
Date: Sat Dec 14 23:07:43 2013
New Revision: 18646

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18646
Log:
divide by 3 the number of leaks reported by Visual Leak Detector by exiting more cleanly from scribus process

Modified:
    trunk/Scribus/scribus/localemgr.cpp
    trunk/Scribus/scribus/localemgr.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusapp.cpp
    trunk/Scribus/scribus/scribuscore.cpp

Modified: trunk/Scribus/scribus/localemgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18646&path=/trunk/Scribus/scribus/localemgr.cpp
==============================================================================
--- trunk/Scribus/scribus/localemgr.cpp (original)
+++ trunk/Scribus/scribus/localemgr.cpp Sat Dec 14 23:07:43 2013
@@ -33,6 +33,7 @@
 #include "scpaths.h"
 
 LocaleManager * LocaleManager::m_instance = 0;
+
 LocaleManager * LocaleManager::instance()
 {
 	if(!m_instance)
@@ -42,6 +43,13 @@
 		m_instance->init();
 	}
 	return m_instance;
+}
+
+void LocaleManager::deleteInstance()
+{
+	if (m_instance)
+		delete m_instance;
+	m_instance = 0;
 }
 
 void LocaleManager::init()

Modified: trunk/Scribus/scribus/localemgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18646&path=/trunk/Scribus/scribus/localemgr.h
==============================================================================
--- trunk/Scribus/scribus/localemgr.h (original)
+++ trunk/Scribus/scribus/localemgr.h Sat Dec 14 23:07:43 2013
@@ -59,6 +59,7 @@
 	
 public:
 	static LocaleManager* instance();
+	static void deleteInstance();
 
 	const QString getUnitFromLocale(QString);
 	void printSelectedForLocale(const QString &locale);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18646&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Dec 14 23:07:43 2013
@@ -454,6 +454,8 @@
 
 ScribusMainWindow::~ScribusMainWindow()
 {
+	if (actionManager)
+		delete actionManager;
 	delete m_doc;
 }
 
@@ -1862,11 +1864,10 @@
 	if (!emergencyActivated)
 		prefsManager->SavePrefs();
 	UndoManager::deleteInstance();
-	PrefsManager::deleteInstance();
 	FormatsManager::deleteInstance();
 	UrlLauncher::deleteInstance();
 //	qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-	qApp->exit(0);
+	ce->accept();
 }
 
 void ScribusMainWindow::requestUpdate(int val)

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18646&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp (original)
+++ trunk/Scribus/scribus/scribusapp.cpp Sat Dec 14 23:07:43 2013
@@ -39,6 +39,7 @@
 #include "scpaths.h"
 #include "prefsfile.h"
 #include "langmgr.h"
+#include "localemgr.h"
 #include "prefsmanager.h"
 #include "commonstrings.h"
 #include "upgradechecker.h"
@@ -97,15 +98,21 @@
 	lang(""),
 	GUILang("")
 {
-	ScQApp=this;
-	ScCore=NULL;
+	ScQApp = this;
+	ScCore = 0;
+	m_scDLMgr = 0;
 
 	initDLMgr();
 }
 
 ScribusQApp::~ScribusQApp()
 {
+	if (m_ScCore)
+		delete m_ScCore;
+	if (m_scDLMgr)
+		delete m_scDLMgr;
 	PrefsManager::deleteInstance();
+	LocaleManager::deleteInstance();
 }
 
 void ScribusQApp::initLang()
@@ -118,7 +125,7 @@
 
 void ScribusQApp::initDLMgr()
 {
-	m_scDLMgr=new ScDLManager(this);
+	m_scDLMgr = new ScDLManager(this);
 	connect(m_scDLMgr, SIGNAL(fileReceived(const QString&)), SLOT(downloadComplete(const QString&)));
 }
 

Modified: trunk/Scribus/scribus/scribuscore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18646&path=/trunk/Scribus/scribus/scribuscore.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuscore.cpp (original)
+++ trunk/Scribus/scribus/scribuscore.cpp Sat Dec 14 23:07:43 2013
@@ -62,7 +62,11 @@
 
 ScribusCore::~ScribusCore()
 {
-// 	delete m_PaletteParent;
+	while (ScMWList.count() > 0)
+	{
+		ScribusMainWindow *mainWindow = ScMWList.takeAt(0);
+		delete mainWindow;
+	}
 }
 
 #ifndef NDEBUG




More information about the scribus-commit mailing list