will prevent any idle events from coming
    anywhere and the last TLW we stay there
    as a ghost.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25917 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
     bool shouldExit = IsLastBeforeExit();
 
     wxTopLevelWindows.DeleteObject(this);
     bool shouldExit = IsLastBeforeExit();
 
     wxTopLevelWindows.DeleteObject(this);
     if ( shouldExit )
     {
         // then do it
     if ( shouldExit )
     {
         // then do it
     if ( !wxPendingDelete.Member(this) )
         wxPendingDelete.Append(this);
 
     if ( !wxPendingDelete.Member(this) )
         wxPendingDelete.Append(this);
 
-    // but hide it immediately
-    Hide();
+    if (wxTopLevelWindows.GetCount() > 1)
+    {
+        // Hide it immediately. This should
+        // not be done if this TLW is the
+        // only one left since we then would
+        // risk not to get any idle events
+        // at all anymore during which we 
+        // could delete any pending events.
+        Hide();
+    }