[qet] [3012] fix some memory leaks

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3012
Author:   blacksun
Date:     2014-04-19 14:56:30 +0200 (Sat, 19 Apr 2014)
Log Message:
-----------
fix some memory leaks

Modified Paths:
--------------
    trunk/sources/elementscollectioncache.cpp
    trunk/sources/qetapp.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/recentfiles.cpp

Modified: trunk/sources/elementscollectioncache.cpp
===================================================================
--- trunk/sources/elementscollectioncache.cpp	2014-04-19 08:04:08 UTC (rev 3011)
+++ trunk/sources/elementscollectioncache.cpp	2014-04-19 12:56:30 UTC (rev 3012)
@@ -65,6 +65,10 @@
 	Destructor
 */
 ElementsCollectionCache::~ElementsCollectionCache() {
+	delete select_name_;
+	delete select_pixmap_;
+	delete insert_name_;
+	delete insert_pixmap_;
 	cache_db_.close();
 }
 

Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp	2014-04-19 08:04:08 UTC (rev 3011)
+++ trunk/sources/qetapp.cpp	2014-04-19 12:56:30 UTC (rev 3012)
@@ -433,14 +433,18 @@
 */
 QString QETApp::userName() {
 	QProcess * process = new QProcess();
+	QString str;
 #ifndef Q_OS_WIN32
 	// return(QString(getenv("USER")));
-	return((process->processEnvironment()).value("USER", "UNKNOWN"));
+	str = (process->processEnvironment()).value("USER", "UNKNOWN");
+	delete process;
+	return(str);
 #else
 	// return(QString(getenv("USERNAME")));
-	return((process->processEnvironment()).value("USERNAME", "UNKNOWN"));
+	str = (process->processEnvironment()).value("USERNAME", "UNKNOWN");
+	delete process;
+	return(str);
 #endif
-	delete process;
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2014-04-19 08:04:08 UTC (rev 3011)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2014-04-19 12:56:30 UTC (rev 3012)
@@ -210,6 +210,11 @@
 	Destructeur
 */
 CustomElement::~CustomElement() {
+	qDeleteAll (list_lines_);
+	qDeleteAll (list_rectangles_);
+	qDeleteAll (list_circles_);
+	qDeleteAll (list_polygons_);
+	qDeleteAll (list_arcs_);
 }
 
 /// @return la liste des bornes de cet element

Modified: trunk/sources/recentfiles.cpp
===================================================================
--- trunk/sources/recentfiles.cpp	2014-04-19 08:04:08 UTC (rev 3011)
+++ trunk/sources/recentfiles.cpp	2014-04-19 12:56:30 UTC (rev 3012)
@@ -168,7 +168,7 @@
 	// remplit le menu
 	foreach (QString filepath, list_) {
 		// creee une nouvelle action pour le fichier
-		QAction *action = new QAction(filepath, 0);
+		QAction *action = new QAction(filepath, this);
 		if (!files_icon_.isNull()) {
 			action -> setIcon(files_icon_);
 		}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/