From: Enar Väikene Date: Tue, 27 Sep 2011 09:50:51 +0000 (+0300) Subject: Made it safe to delete widgets and layouts added to the main window in the original... X-Git-Url: https://vaikene.ee/gitweb/index.html?a=commitdiff_plain;h=f443e47f50a5d12f592aaae6a4e553e4a125ee1c;p=evaf Made it safe to delete widgets and layouts added to the main window in the original (or any other) module before finalizing the SdiWindow module. --- diff --git a/src/plugins/SdiWindow/sdiwindow.cpp b/src/plugins/SdiWindow/sdiwindow.cpp index 4be6efe..d0294d8 100644 --- a/src/plugins/SdiWindow/sdiwindow.cpp +++ b/src/plugins/SdiWindow/sdiwindow.cpp @@ -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 item = mItemsAdded.takeAt(0); + if (item) + delete item.data(); + } EVAF_INFO("%s finalized", qPrintable(objectName())); } diff --git a/src/plugins/SdiWindow/sdiwindow.h b/src/plugins/SdiWindow/sdiwindow.h index b2c3bc6..31b311d 100644 --- a/src/plugins/SdiWindow/sdiwindow.h +++ b/src/plugins/SdiWindow/sdiwindow.h @@ -28,6 +28,7 @@ #include #include #include +#include class QVBoxLayout; @@ -72,7 +73,7 @@ private: // Members QVBoxLayout * mLayout; /// Widgets and layouts added to the main window - QList mItemsAdded; + QList > mItemsAdded; }; diff --git a/src/plugins/SdiWindow/version.h b/src/plugins/SdiWindow/version.h index 4eb90dd..44023e6 100644 --- a/src/plugins/SdiWindow/version.h +++ b/src/plugins/SdiWindow/version.h @@ -25,12 +25,12 @@ /** * 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)