From 781130bf6070ea8b93981ea95c1a786eefc2842e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Apr 2007 19:43:28 +0000 Subject: [PATCH] fix m_sizerPage memory leak for the wizards not using sizers (replaces patch 1708331, fixes bug 1647290) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/generic/wizard.h | 1 + src/generic/wizard.cpp | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index a03f1d283b..d254faba40 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -160,6 +160,7 @@ All (Unix): All (GUI): - Allow status bar children in XRC (Edmunt Pienkowski) +- Fix memory leak in wxWizard when not using sizers for the page layout wxMSW: diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index 52940b2a82..0b0f5bed6f 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -44,6 +44,7 @@ public: const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE); void Init(); + virtual ~wxWizard(); // implement base class pure virtuals virtual bool RunWizard(wxWizardPage *firstPage); diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index 20c5e12750..c6581d6d39 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -312,6 +312,15 @@ bool wxWizard::Create(wxWindow *parent, return result; } +wxWizard::~wxWizard() +{ + // normally we don't have to delete this sizer as it's deleted by the + // associated window but if we never used it or didn't set it as the window + // sizer yet, do delete it manually + if ( !m_usingSizer || !m_started ) + delete m_sizerPage; +} + void wxWizard::AddBitmapRow(wxBoxSizer *mainColumn) { m_sizerBmpAndPage = new wxBoxSizer(wxHORIZONTAL); -- 2.45.2