Do a sanity check to make sure GetWindow() has a valid window, and assert if it doesn't. On OS X Cocoa, try to continue on in release mode.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2435,11 +2435,14 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC&
|
|||||||
int w, h;
|
int w, h;
|
||||||
win_impl->GetSize( &w, &h );
|
win_impl->GetSize( &w, &h );
|
||||||
CGContextRef cgctx = 0;
|
CGContextRef cgctx = 0;
|
||||||
#ifdef __WXMAC__
|
wxASSERT_MSG(win_impl->GetWindow(), "Invalid wxWindow in wxMacCoreGraphicsRenderer::CreateContext");
|
||||||
|
if (win_impl->GetWindow())
|
||||||
cgctx = (CGContextRef)(win_impl->GetWindow()->MacGetCGContextRef());
|
cgctx = (CGContextRef)(win_impl->GetWindow()->MacGetCGContextRef());
|
||||||
#else
|
#if wxOSX_USE_COCOA
|
||||||
|
else
|
||||||
cgctx = wxMacGetContextFromCurrentNSContext() ;
|
cgctx = wxMacGetContextFromCurrentNSContext() ;
|
||||||
#endif
|
#endif
|
||||||
|
if (cgctx != 0)
|
||||||
return new wxMacCoreGraphicsContext( this, cgctx, (wxDouble) w, (wxDouble) h );
|
return new wxMacCoreGraphicsContext( this, cgctx, (wxDouble) w, (wxDouble) h );
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user