]> git.saurik.com Git - wxWidgets.git/commitdiff
closes #13841
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 14 Feb 2013 08:07:24 +0000 (08:07 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 14 Feb 2013 08:07:24 +0000 (08:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/combocmn.cpp

index 06bb0409915d094ae606a8f85ae59d5d765464b1..c2f01598e2d0df05a3673d25ec6751f6ec797148 100644 (file)
@@ -2050,21 +2050,23 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event)
 
 void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
 {
-// On Mac, this leads to infinite recursion and eventually a crash
-#ifdef __WXMAC__
-    wxUnusedVar(event);
-#else
+    // On Mac, setting focus here leads to infinite recursion and eventually
+    // a crash due to the SetFocus call producing another event.
+    // Handle Mac in OnIdleEvent using m_resetFocus.
+    
     if ( event.GetEventType() == wxEVT_SET_FOCUS )
     {
-        wxWindow* tc = GetTextCtrl();
-        if ( tc && tc != DoFindFocus() )
+        if ( GetTextCtrl() && !GetTextCtrl()->HasFocus() )
         {
-            tc->SetFocus();
+#ifdef __WXMAC__
+            m_resetFocus = true;
+#else
+            GetTextCtrl()->SetFocus();
+#endif
         }
     }
-
+    
     Refresh();
-#endif
 }
 
 void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) )
@@ -2072,9 +2074,8 @@ void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) )
     if ( m_resetFocus )
     {
         m_resetFocus = false;
-        wxWindow* tc = GetTextCtrl();
-        if ( tc )
-            tc->SetFocus();
+        if ( GetTextCtrl() )
+            GetTextCtrl()->SetFocus();
     }
 }