git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63593
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
wxPropertyGridPageState* state = m_parentState;
{
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);