mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
ElementsPanel: removed the old, error-prone, thread-based implementation of ElementsPanel::reloadCollections().
Reverted rev2011 to prevent memory leak. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2013 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -28,37 +28,6 @@
|
|||||||
#include "templatescollection.h"
|
#include "templatescollection.h"
|
||||||
#include "treecoloranimation.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
|
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.
|
effectue des verifications lors des drag'n drop d'elements et categories.
|
||||||
@@ -540,11 +509,14 @@ bool ElementsPanel::matchesCurrentFilter(const QTreeWidgetItem *item) const {
|
|||||||
* collection of every project displayed in this panel
|
* collection of every project displayed in this panel
|
||||||
*/
|
*/
|
||||||
void ElementsPanel::reloadCollections() {
|
void ElementsPanel::reloadCollections() {
|
||||||
ReloadCollectionThread thread;
|
QETApp::commonElementsCollection() -> reload();
|
||||||
thread.projects_ = projects_to_display_.values();
|
QETApp::customElementsCollection() -> reload();
|
||||||
thread.start();
|
|
||||||
while(!thread.wait(50)) {
|
// reloads collection of every project displayed in this panel
|
||||||
QApplication::processEvents();
|
foreach(QETProject *project, projects_to_display_) {
|
||||||
|
if (ElementsCollection *project_collection = project -> embeddedCollection()) {
|
||||||
|
project_collection -> reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void FileElementsCollection::setFilePath(const QString &path) {
|
|||||||
Supprime le contenu en memoire de cette collection
|
Supprime le contenu en memoire de cette collection
|
||||||
*/
|
*/
|
||||||
void FileElementsCollection::deleteContent() {
|
void FileElementsCollection::deleteContent() {
|
||||||
if(!root) delete root;
|
delete root;
|
||||||
root = 0;
|
root = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user