Remove GC-aware code and fix clip view leak

Remove "GC-aware" code as GC is not supported by the OS any longer.

Fix leak of wxWindow::m_osxClipView by releasing it after adding it as
subview.
This commit is contained in:
Stefan Csomor
2026-02-20 23:34:27 +01:00
committed by Vadim Zeitlin
parent b0d50ffe91
commit 5e2caa4db9
2 changed files with 4 additions and 15 deletions

View File

@@ -163,10 +163,6 @@ public :
}
[menu setDelegate:controller];
[m_osxMenu setImplementation:this];
// gc aware
if ( m_osxMenu )
CFRetain(m_osxMenu);
[m_osxMenu release];
}
virtual ~wxMenuCocoaImpl();
@@ -413,9 +409,7 @@ wxMenuCocoaImpl::~wxMenuCocoaImpl()
{
[m_osxMenu setDelegate:nil];
[m_osxMenu setImplementation:nil];
// gc aware
if ( m_osxMenu )
CFRelease(m_osxMenu);
[m_osxMenu release];
}
wxMenuImpl* wxMenuImpl::Create( wxMenu* peer, const wxString& title )

View File

@@ -2730,11 +2730,6 @@ wxWidgetImpl( peer, flags )
if ( !peer->IsShown() )
SetVisibility(false);
// gc aware handling
if ( m_osxView )
CFRetain(m_osxView);
[m_osxView release];
if ( IsUserPane() )
ClipsToBounds(true);
}
@@ -2771,11 +2766,10 @@ wxWidgetCocoaImpl::~wxWidgetCocoaImpl()
if ( sv != nil )
[m_osxView removeFromSuperview];
}
// gc aware handling
if ( m_osxView )
CFRelease(m_osxView);
wxCocoaGestures::EraseForObject(this);
[m_osxView release];
}
void wxWidgetCocoaImpl::BeginNativeKeyDownEvent( NSEvent* event )
@@ -4315,6 +4309,7 @@ void wxWidgetCocoaImpl::UseClippingView()
m_osxClipView = [[wxNSClipView alloc] initWithFrame: m_osxView.bounds];
[(NSClipView*)m_osxClipView setDrawsBackground: NO];
[m_osxView addSubview:m_osxClipView];
[m_osxClipView release];
// add tracking for this clipview as well