]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
fix for bug reported by Robert and Julian, probably causes other problems
[wxWidgets.git] / src / mac / carbon / window.cpp
index 85a70799c9ece02776feae589b7df08f5cbc2a21..af2cb1118d72e1a4c1d17aa71413f958517cafe9 100644 (file)
@@ -148,6 +148,22 @@ wxWindowMac::~wxWindowMac()
     
     m_isBeingDeleted = TRUE;
 
+#ifndef __WXUNIVERSAL__
+    // VS: make sure there's no wxFrame with last focus set to us:
+    for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
+    {
+        wxFrame *frame = wxDynamicCast(win, wxFrame);
+        if ( frame )
+        {
+            if ( frame->GetLastFocus() == this )
+            {
+                frame->SetLastFocus((wxWindow*)NULL);
+            }
+            break;
+        }
+    }
+#endif // __WXUNIVERSAL__
+
     if ( s_lastMouseWindow == this )
     {
         s_lastMouseWindow = NULL ;