From e4e55c061f2cf3261bdf7928a180f1d973725699 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Mon, 1 Mar 2010 15:30:03 +0000 Subject: [PATCH] Have to implement wxPGProperty::DeleteChildren() differently so that it will work with deferred property deletion git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/property.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 4e82bcc338..893eb3f0a6 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -2455,10 +2455,16 @@ void wxPGProperty::DeleteChildren() { wxPropertyGridPageState* state = m_parentState; - while ( GetChildCount() ) + if ( !GetChildCount() ) + return; + + // Because deletion is sometimes deferred, we have to use + // this sort of code for enumerating the child properties. + unsigned int i = GetChildCount(); + while ( i > 0 ) { - wxPGProperty* child = Item(GetChildCount()-1); - state->DoDelete(child, true); + i--; + state->DoDelete(Item(i), true); } } -- 2.45.2