Added a check to make sure 'parent' is valid, otherwise a crash could occur
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1150,12 +1150,15 @@ void wxWindow::DoGetPosition(int *x, int *y) const
|
|||||||
::ScreenToClient(hParentWnd, &point);
|
::ScreenToClient(hParentWnd, &point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( parent )
|
||||||
|
{
|
||||||
// We may be faking the client origin. So a window that's really at (0,
|
// We may be faking the client origin. So a window that's really at (0,
|
||||||
// 30) may appear (to wxWin apps) to be at (0, 0).
|
// 30) may appear (to wxWin apps) to be at (0, 0).
|
||||||
wxPoint pt(parent->GetClientAreaOrigin());
|
wxPoint pt(parent->GetClientAreaOrigin());
|
||||||
point.x -= pt.x;
|
point.x -= pt.x;
|
||||||
point.y -= pt.y;
|
point.y -= pt.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( x )
|
if ( x )
|
||||||
*x = point.x;
|
*x = point.x;
|
||||||
|
Reference in New Issue
Block a user