[qet] [1342] Fixed a segfault occurring when trying to open a non-QET file.

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


Revision: 1342
Author:   xavier
Date:     2011-09-29 06:42:25 +0200 (Thu, 29 Sep 2011)
Log Message:
-----------
Fixed a segfault occurring when trying to open a non-QET file.

Modified Paths:
--------------
    branches/0.3/sources/qetproject.cpp

Modified: branches/0.3/sources/qetproject.cpp
===================================================================
--- branches/0.3/sources/qetproject.cpp	2011-09-25 21:47:20 UTC (rev 1341)
+++ branches/0.3/sources/qetproject.cpp	2011-09-29 04:42:25 UTC (rev 1342)
@@ -37,6 +37,7 @@
 */
 QETProject::QETProject(int diagrams, QObject *parent) :
 	QObject(parent),
+	collection_(0),
 	project_qet_version_(-1),
 	read_only_(false)
 {
@@ -63,6 +64,7 @@
 */
 QETProject::QETProject(const QString &path, QObject *parent) :
 	QObject(parent),
+	collection_(0),
 	project_qet_version_(-1),
 	read_only_(false)
 {
@@ -97,6 +99,7 @@
 */
 QETProject::QETProject(const QDomElement &xml_element, QObject *parent) :
 	QObject(parent),
+	collection_(0),
 	project_qet_version_(-1),
 	read_only_(false)
 {
@@ -116,7 +119,9 @@
 	
 	// supprime la collection
 	// qDebug() << "Suppression de la collection du projet" << ((void *)this);
-	delete collection_;
+	if (collection_) {
+		delete collection_;
+	}
 	// qDebug() << "Collection du projet" << ((void *)this) << "supprimee";
 	
 	// qDebug() << diagrams_;


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