]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/checkbox_osx.cpp
fix for crash when undocking AUI toolbars (same as r59107 in 2.8 branch)
[wxWidgets.git] / src / osx / checkbox_osx.cpp
index 0e224f15d74b19bdc6bce4c96f8097121cd76bb2..4a0b46ecd8b5accc77586421adf7427612702c39 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/carbon/checkbox.cpp
+// Name:        src/osx/carbon/checkbox.cpp
 // Purpose:     wxCheckBox
 // Author:      Stefan Csomor
 // Modified by:
@@ -80,33 +80,41 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
     m_peer->SetValue( val ) ;
 }
 
-bool wxCheckBox::HandleClicked( double timestampsec ) 
+bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) 
 {
-    wxCheckBoxState origState, newState;
-
-    newState = origState = Get3StateValue();
-
-    switch (origState)
+    bool sendEvent = true;
+    wxCheckBoxState newState = Get3StateValue();
+    
+    if ( !m_peer->ButtonClickDidStateChange() )
     {
-        case wxCHK_UNCHECKED:
-            newState = wxCHK_CHECKED;
-            break;
-
-        case wxCHK_CHECKED:
-            // If the style flag to allow the user setting the undetermined state is set,
-            // then set the state to undetermined; otherwise set state to unchecked.
-            newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED;
-            break;
-
-        case wxCHK_UNDETERMINED:
-            newState = wxCHK_UNCHECKED;
-            break;
-
-        default:
-            break;
+        wxCheckBoxState origState ;
+
+        newState = origState = Get3StateValue();
+
+        switch (origState)
+        {
+            case wxCHK_UNCHECKED:
+                newState = wxCHK_CHECKED;
+                break;
+
+            case wxCHK_CHECKED:
+                // If the style flag to allow the user setting the undetermined state is set,
+                // then set the state to undetermined; otherwise set state to unchecked.
+                newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED;
+                break;
+
+            case wxCHK_UNDETERMINED:
+                newState = wxCHK_UNCHECKED;
+                break;
+
+            default:
+                break;
+        }
+        if (newState == origState)
+            sendEvent = false;
     }
 
-    if (newState != origState)
+    if (sendEvent)
     {
         Set3StateValue( newState );