]> git.saurik.com Git - wxWidgets.git/commitdiff
Have to implement wxPGProperty::DeleteChildren() differently so that it will work...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 1 Mar 2010 15:30:03 +0000 (15:30 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 1 Mar 2010 15:30:03 +0000 (15:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/property.cpp

index 4e82bcc338f0bddbd27b241554d95a7111645f1f..893eb3f0a6ee43d960c58ce6ce7733385134d0b7 100644 (file)
@@ -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);
     }
 }