[qet] [2013] ElementsPanel: removed the old, error-prone, thread-based implementation of ElementsPanel::reloadCollections().

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


Revision: 2013
Author:   xavier
Date:     2013-01-27 16:48:14 +0100 (Sun, 27 Jan 2013)
Log Message:
-----------
ElementsPanel: removed the old, error-prone, thread-based implementation of ElementsPanel::reloadCollections().
Reverted rev2011 to prevent memory leak.

Modified Paths:
--------------
    trunk/sources/elementspanel.cpp
    trunk/sources/fileelementscollection.cpp

Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp	2013-01-27 15:46:38 UTC (rev 2012)
+++ trunk/sources/elementspanel.cpp	2013-01-27 15:48:14 UTC (rev 2013)
@@ -28,37 +28,6 @@
 #include "templatescollection.h"
 #include "treecoloranimation.h"
 
-/**
-	This class implements a thread reloading the following elements
-	collections:
-	  * the common collection
-	  * the custom collection
-	  * the embedded collection of each project listed in the projects_
-	attribute.
-*/
-class ReloadCollectionThread : public QThread {
-	public:
-	void run();
-	/// list of projects whose embedded collection should be reloaded.
-	QList<QETProject *> projects_;
-};
-
-/**
-	Reloads collections.
-*/
-void ReloadCollectionThread::run() {
-	QETApp::commonElementsCollection() -> reload();
-	QETApp::customElementsCollection() -> reload();
-	
-	// reloads collection of every project displayed in this panel
-	foreach(QETProject *project, projects_) {
-		if (ElementsCollection *project_collection = project -> embeddedCollection()) {
-			project_collection -> reload();
-		}
-	}
-	exit();
-}
-
 /*
 	Lorsque le flag ENABLE_PANEL_DND_CHECKS est defini, le panel d'elements
 	effectue des verifications lors des drag'n drop d'elements et categories.
@@ -540,11 +509,14 @@
 	  * collection of every project displayed in this panel
 */
 void ElementsPanel::reloadCollections() {
-	ReloadCollectionThread thread;
-	thread.projects_ = projects_to_display_.values();
-	thread.start();
-	while(!thread.wait(50)) {
-		QApplication::processEvents();
+	QETApp::commonElementsCollection() -> reload();
+	QETApp::customElementsCollection() -> reload();
+	
+	// reloads collection of every project displayed in this panel
+	foreach(QETProject *project, projects_to_display_) {
+		if (ElementsCollection *project_collection = project -> embeddedCollection()) {
+			project_collection -> reload();
+		}
 	}
 }
 

Modified: trunk/sources/fileelementscollection.cpp
===================================================================
--- trunk/sources/fileelementscollection.cpp	2013-01-27 15:46:38 UTC (rev 2012)
+++ trunk/sources/fileelementscollection.cpp	2013-01-27 15:48:14 UTC (rev 2013)
@@ -89,7 +89,7 @@
 	Supprime le contenu en memoire de cette collection
 */
 void FileElementsCollection::deleteContent() {
-	if(!root)	delete root;
+	delete root;
 	root = 0;
 }
 


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