From: Stefan Csomor Date: Wed, 19 Aug 2009 13:01:08 +0000 (+0000) Subject: adding gc aware code, fixes #11061 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9a038ddca4ae6ddff438695760d94d6fa935bfd4 adding gc aware code, fixes #11061 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index cce72f4260..34cd2079e2 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -55,7 +55,7 @@ @end -@interface wxNSMenuController : NSObject +@interface wxNSMenuController : NSObject { } @@ -133,6 +133,10 @@ public : } [menu setDelegate:controller]; [m_osxMenu setImplementation:this]; + // gc aware + if ( m_osxMenu ) + CFRetain(m_osxMenu); + [m_osxMenu release]; } virtual ~wxMenuCocoaImpl(); @@ -196,7 +200,9 @@ wxMenuCocoaImpl::~wxMenuCocoaImpl() { [m_osxMenu setDelegate:nil]; [m_osxMenu setImplementation:nil]; - [m_osxMenu release]; + // gc aware + if ( m_osxMenu ) + CFRelease(m_osxMenu); } wxMenuImpl* wxMenuImpl::Create( wxMenu* peer, const wxString& title ) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 1e7bfd251b..f645830968 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -1127,6 +1127,10 @@ wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRoo { Init(); m_osxView = w; + // gc aware handling + if ( m_osxView ) + CFRetain(m_osxView); + [m_osxView release]; } wxWidgetCocoaImpl::wxWidgetCocoaImpl() @@ -1152,7 +1156,9 @@ wxWidgetCocoaImpl::~wxWidgetCocoaImpl() if ( sv != nil ) [m_osxView removeFromSuperview]; } - [m_osxView release]; + // gc aware handling + if ( m_osxView ) + CFRelease(m_osxView); } bool wxWidgetCocoaImpl::IsVisible() const