From f443e47f50a5d12f592aaae6a4e553e4a125ee1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enar=20V=C3=A4ikene?= Date: Tue, 27 Sep 2011 12:50:51 +0300 Subject: [PATCH] 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. --- src/plugins/SdiWindow/sdiwindow.cpp | 7 +++++-- src/plugins/SdiWindow/sdiwindow.h | 3 ++- src/plugins/SdiWindow/version.h | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) 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) -- 2.47.0