]> git.saurik.com Git - wxWidgets.git/commitdiff
fix an assert failure when a child TLW was created and destroyed while the parent...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 5 Aug 2008 22:47:11 +0000 (22:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 5 Aug 2008 22:47:11 +0000 (22:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp

index b9942fa0a85daf51156728b385cf1417f37fd885..8ce661082e3f6806a84fa5f65ed372620faa546c 100644 (file)
@@ -1007,7 +1007,7 @@ void wxWindowBase::AddChild(wxWindowBase *child)
     GetChildren().Append((wxWindow*)child);
     child->SetParent(this);
 
-    // adding a child while frozen will assert when thawn, so freeze it as if
+    // adding a child while frozen will assert when thawed, so freeze it as if
     // it had been already present when we were frozen
     if ( IsFrozen() && !child->IsTopLevel() )
         child->Freeze();
@@ -1019,7 +1019,10 @@ void wxWindowBase::RemoveChild(wxWindowBase *child)
 
     // removing a child while frozen may result in permanently frozen window
     // if used e.g. from Reparent(), so thaw it
-    if ( IsFrozen() && !child->IsTopLevel() )
+    //
+    // NB: IsTopLevel() doesn't return true any more when a TLW child is being
+    //     removed from its ~wxWindowBase, so check for IsBeingDeleted() too
+    if ( IsFrozen() && !child->IsBeingDeleted() && !child->IsTopLevel() )
         child->Thaw();
 
     GetChildren().DeleteObject((wxWindow *)child);