X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90230407984b0bbe9d6ed6ae6dc2376700ef1d42..7be2a7af39888b264eb0c5787fb2914005633d1b:/src/common/toplvcmn.cpp

diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp
index 1ce788ef1f..e93cdc024f 100644
--- a/src/common/toplvcmn.cpp
+++ b/src/common/toplvcmn.cpp
@@ -361,6 +361,14 @@ void wxTopLevelWindowBase::SetIcon(const wxIcon& icon)
 // whole client area
 void wxTopLevelWindowBase::DoLayout()
 {
+    // We are called during the window destruction several times, e.g. as
+    // wxFrame tries to adjust to its tool/status bars disappearing. But
+    // actually doing the layout is pretty useless in this case as the window
+    // will disappear anyhow -- so just don't bother.
+    if ( IsBeingDeleted() )
+        return;
+
+
     // if we're using constraints or sizers - do use them
     if ( GetAutoLayout() )
     {