Avoid crashing when using wxOverlay under macOS 10.14

Retain the graphics context for the helper overlay window as otherwise
it gets released leaving us with a dangling pointer.

Unfortunately this still doesn't make the existing code actually work.

See #18399.
This commit is contained in:
Vadim Zeitlin
2019-10-20 17:52:04 +02:00
parent ad6799f249
commit 8b95467256

View File

@@ -114,6 +114,7 @@ void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height )
wxASSERT_MSG(m_overlayWindow != NULL, _("Couldn't create the overlay window"));
m_overlayContext = (CGContextRef) [[m_overlayWindow graphicsContext] graphicsPort];
wxASSERT_MSG( m_overlayContext != NULL , _("Couldn't init the context on the overlay window") );
[(id)m_overlayContext retain];
}
void wxOverlayImpl::BeginDrawing( wxDC* dc)
@@ -167,6 +168,7 @@ void wxOverlayImpl::Reset()
{
if ( m_overlayContext )
{
[(id)m_overlayContext release];
m_overlayContext = NULL ;
}