From: Kevin Ollivier Date: Thu, 11 Sep 2008 05:35:10 +0000 (+0000) Subject: A few checks for null pointers to avoid problems during app shutdown. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1a4e2d5b2f91f6d7f5700bd166a990e817f71b6f A few checks for null pointers to avoid problems during app shutdown. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index f2466b5526..d4edf5f180 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -496,7 +496,7 @@ bool wxWindowMac::MacGetBoundsForControl( AdjustForParentClientOrigin( x , y ) ; // this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border - if ( !GetParent()->IsTopLevel() ) + if ( GetParent() && !GetParent()->IsTopLevel() ) { x -= GetParent()->MacGetLeftBorderSize() ; y -= GetParent()->MacGetTopBorderSize() ; @@ -834,10 +834,12 @@ void wxWindowMac::MacInvalidateBorders() wxRect topupdate( tx-outerBorder, ty-outerBorder, tw + 2 * outerBorder, outerBorder ); wxRect bottomupdate( tx-outerBorder, ty + th, tw + 2 * outerBorder, outerBorder ); - GetParent()->m_peer->SetNeedsDisplay(&leftupdate); - GetParent()->m_peer->SetNeedsDisplay(&rightupdate); - GetParent()->m_peer->SetNeedsDisplay(&topupdate); - GetParent()->m_peer->SetNeedsDisplay(&bottomupdate); + if (GetParent()) { + GetParent()->m_peer->SetNeedsDisplay(&leftupdate); + GetParent()->m_peer->SetNeedsDisplay(&rightupdate); + GetParent()->m_peer->SetNeedsDisplay(&topupdate); + GetParent()->m_peer->SetNeedsDisplay(&bottomupdate); + } } void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) @@ -887,9 +889,9 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) wxSize( actualWidth - (MacGetLeftBorderSize() + MacGetRightBorderSize()) , actualHeight - (MacGetTopBorderSize() + MacGetBottomBorderSize()) ) ) ; - if ( !GetParent()->IsTopLevel() ) + if ( parent && !parent->IsTopLevel() ) { - bounds.Offset( -GetParent()->MacGetLeftBorderSize(), -GetParent()->MacGetTopBorderSize() ); + bounds.Offset( -parent->MacGetLeftBorderSize(), -parent->MacGetTopBorderSize() ); } MacInvalidateBorders() ;