From 718dbef6c501a77bd6b78ba7db58526e047d8bdc Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 1 May 2007 09:37:56 +0000 Subject: [PATCH] Patch 1709108 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index d491c42b04..197cacdb3c 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -867,7 +867,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; }