]> vaikene.ee Git - evaf/commitdiff
Made it safe to delete widgets and layouts added to the main window in the original...
authorEnar Väikene <enar@vaikene.net>
Tue, 27 Sep 2011 09:50:51 +0000 (12:50 +0300)
committerEnar Väikene <enar@vaikene.net>
Tue, 27 Sep 2011 09:50:51 +0000 (12:50 +0300)
finalizing the SdiWindow module.

src/plugins/SdiWindow/sdiwindow.cpp
src/plugins/SdiWindow/sdiwindow.h
src/plugins/SdiWindow/version.h

index 4be6efe4f333b9b075db4e6dbdd6e2f52a38ccf5..d0294d8c83c1e18fddee8cc105170a9020de20eb 100644 (file)
@@ -94,8 +94,11 @@ void MainWindow::done()
     close();
 
     // Delete all the items added to the main window
-    while (mItemsAdded.count() > 0)
-        delete mItemsAdded.takeAt(0);
+    while (mItemsAdded.count() > 0) {
+        QPointer<QObject> item = mItemsAdded.takeAt(0);
+        if (item)
+            delete item.data();
+    }
 
     EVAF_INFO("%s finalized", qPrintable(objectName()));
 }
index b2c3bc6c2fbdd69a1120d997091dd1bd586e489c..31b311d60454d8a4c4d04efa640f5fb88bf7b4b4 100644 (file)
@@ -28,6 +28,7 @@
 #include <QString>
 #include <QWidget>
 #include <QList>
+#include <QPointer>
 
 class QVBoxLayout;
 
@@ -72,7 +73,7 @@ private: // Members
     QVBoxLayout * mLayout;
 
     /// Widgets and layouts added to the main window
-    QList<QObject *> mItemsAdded;
+    QList<QPointer<QObject> > mItemsAdded;
 
 };
 
index 4eb90ddf7d2bfdf4d62be5a50f2c00f740d275c6..44023e6fbbd6bdbba926504b27baaf16e94fd3a4 100644 (file)
 /**
  * Module/library version number in the form major,minor,release,build
  */
-#define VER_FILE_VERSION                0,2,1,2
+#define VER_FILE_VERSION                0,2,2,3
 
 /**
  * Module/library version number in the string format (shall end with \0)
  */
-#define VER_FILE_VERSION_STR            "0.2.1.2\0"
+#define VER_FILE_VERSION_STR            "0.2.2.3\0"
 
 /**
  * Module/library name (shall end with \0)