]> git.saurik.com Git - wxWidgets.git/commitdiff
Check if MacGetTopLevelWindow returns NULL before using it. This can
authorRobin Dunn <robin@alldunn.com>
Mon, 14 Jun 2004 22:04:55 +0000 (22:04 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 14 Jun 2004 22:04:55 +0000 (22:04 +0000)
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

index 305886f8907b940a6920ed72478fde045dfd5d78..9088d2f57aadb9b31a9b0c0c5be9ed79d09fa5c8 100644 (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 ;