From 5437ff47ec2ee9bd44a54b4584965b8a5ffbfe1d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 14 Jun 2004 22:04:55 +0000 Subject: [PATCH 1/1] 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 --- src/mac/carbon/window.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 305886f890..9088d2f57a 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -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 ; -- 2.47.2