From 14432092198e917eac2b5ae7172b71c568f17669 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 26 Aug 2014 22:54:01 +0000 Subject: [PATCH] Fix deleting aggregate properties from within wxPG event handler. Do not explicitly remove sub-properties of aggregate property because they will be removed automatically in their parent property dtor. See #16459 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/propgridpagestate.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 32ac784b3c..91a402f922 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -277,7 +277,7 @@ void wxPropertyGridPageState::InitNonCatMode() void wxPropertyGridPageState::DoClear() { - if ( m_pPropGrid && m_pPropGrid->GetState() == this ) + if ( m_pPropGrid && m_pPropGrid->GetState() == this ) { m_pPropGrid->ClearSelection(false); } @@ -295,7 +295,11 @@ void wxPropertyGridPageState::DoClear() !it.AtEnd(); it++ ) { - DoDelete(*it, true); + wxPGProperty *p = *it; + // Do not attempt to explicitly remove sub-properties. + // They will be removed in their parent property dtor. + if ( !p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) + DoDelete(p, true); } } else