]> git.saurik.com Git - wxWidgets.git/commitdiff
Patch 1709108
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 1 May 2007 11:41:11 +0000 (11:41 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 1 May 2007 11:41:11 +0000 (11:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/utils.cpp

index c777fce3443264dc154bf7385fd267326edd7574..39597ec4eb347749c1af670749dfa3bb9def82c5 100644 (file)
@@ -796,7 +796,10 @@ void wxMacControl::Dispose()
     wxASSERT_MSG( IsValidControlHandle(m_controlRef) , wxT("Invalid Control Handle (maybe already released) in Dispose") );
 
     // we cannot check the ref count here anymore, as autorelease objects might delete their refs later
-    CFRelease(m_controlRef);
+    // we can have situations when being embedded, where the control gets deleted behind our back, so only
+    // CFRelease if we are safe
+    if ( IsValidControlHandle(m_controlRef) )
+        CFRelease(m_controlRef);
     m_controlRef = NULL;
 }