r18650 by jghali - reduce number of leaks reported by VLD by deleting LanguageManager instance on exit

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 15 19:02:46 UTC 2013


Author: jghali
Date: Sun Dec 15 19:02:45 2013
New Revision: 18650

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18650
Log:
reduce number of leaks reported by VLD by deleting LanguageManager instance on exit

Modified:
    trunk/Scribus/scribus/langmgr.cpp
    trunk/Scribus/scribus/langmgr.h
    trunk/Scribus/scribus/scribusapp.cpp

Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18650&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Sun Dec 15 19:02:45 2013
@@ -32,6 +32,7 @@
 #include "scpaths.h"
 
 LanguageManager * LanguageManager::m_instance = 0;
+
 LanguageManager * LanguageManager::instance()
 {
 	if(!m_instance)
@@ -41,6 +42,13 @@
 		m_instance->init();
 	}
 	return m_instance;
+}
+
+void LanguageManager::deleteInstance()
+{
+	if (m_instance)
+		delete m_instance;
+	m_instance = 0;
 }
 
 void LanguageManager::languageChange()

Modified: trunk/Scribus/scribus/langmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18650&path=/trunk/Scribus/scribus/langmgr.h
==============================================================================
--- trunk/Scribus/scribus/langmgr.h (original)
+++ trunk/Scribus/scribus/langmgr.h Sun Dec 15 19:02:45 2013
@@ -32,17 +32,17 @@
 
 typedef std::pair<QString, QString> langPair;
 
-
-
 class SCRIBUS_API LanguageManager
 {
-	static LanguageManager* m_instance;
 	LanguageManager() {};
 	~LanguageManager();
+
 	void init(bool generateInstalledList = true);
 	
 public:
 	static LanguageManager* instance();
+	static void deleteInstance();
+
 	void languageChange();
 	QStringList languageList(bool getTranslated=true);
 	
@@ -63,7 +63,9 @@
 	const QString getHyphFilename(const QString& langAbbrev);
 	int langTableIndex(const QString& abbrev);
 
-	private:
+private:
+	static LanguageManager* m_instance;
+
 	QList <LangDef> langTable;
 
 	void generateLangList();

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18650&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp (original)
+++ trunk/Scribus/scribus/scribusapp.cpp Sun Dec 15 19:02:45 2013
@@ -113,6 +113,7 @@
 		delete m_scDLMgr;
 	PrefsManager::deleteInstance();
 	LocaleManager::deleteInstance();
+	LanguageManager::deleteInstance();
 }
 
 void ScribusQApp::initLang()




More information about the scribus-commit mailing list