Check if MacGetTopLevelWindow returns NULL before using it. This can

happen when the toplevel window is beign destroyed but a decendent
window (child, grandchild...) has an EVT_KILL_FOCUS handler that does
some drawing or other significant work.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2004-06-14 22:04:55 +00:00
parent 4c51584544
commit 5437ff47ec

View File

@ -1204,7 +1204,11 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const
if ( y ) pt.y = *y ;
if ( !IsTopLevel() )
HIViewConvertPoint( &pt , *m_peer , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ;
{
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
if (top)
HIViewConvertPoint( &pt , *m_peer , (ControlRef) top->GetHandle() ) ;
}
if ( x ) *x = (int) pt.x ;
if ( y ) *y = (int) pt.y ;