don't dereferencep ossibly NULL pointers in DoScreenToClient/ClientToScreen()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-30 13:34:41 +00:00
parent e1379e29e2
commit c5c0121402
2 changed files with 20 additions and 13 deletions

View File

@@ -1212,9 +1212,11 @@ void wxWindow::DoScreenToClient(int *x, int *y) const
Window thisWindow = XtWindow(widget);
Window childWindow;
int xx = *x;
int yy = *y;
XTranslateCoordinates(display, rootWindow, thisWindow, xx, yy, x, y, &childWindow);
int xx = x ? *x : 0;
int yy = y ? *y : 0;
XTranslateCoordinates(display, rootWindow, thisWindow,
xx, yy, x ? x : &xx, y ? y : &yy,
&childWindow);
}
void wxWindow::DoClientToScreen(int *x, int *y) const
@@ -1225,9 +1227,11 @@ void wxWindow::DoClientToScreen(int *x, int *y) const
Window thisWindow = XtWindow(widget);
Window childWindow;
int xx = *x;
int yy = *y;
XTranslateCoordinates(display, thisWindow, rootWindow, xx, yy, x, y, &childWindow);
int xx = x ? *x : 0;
int yy = y ? *y : 0;
XTranslateCoordinates(display, thisWindow, rootWindow,
xx, yy, x ? x : &xx, y ? y : &yy,
&childWindow);
}

View File

@@ -805,9 +805,11 @@ void wxWindowX11::DoScreenToClient(int *x, int *y) const
Window thisWindow = (Window) m_clientWindow;
Window childWindow;
int xx = *x;
int yy = *y;
XTranslateCoordinates(display, rootWindow, thisWindow, xx, yy, x, y, &childWindow);
int xx = x ? *x : 0;
int yy = y ? *y : 0;
XTranslateCoordinates(display, rootWindow, thisWindow,
xx, yy, x ? x : &xx, y ? y : &yy,
&childWindow);
}
void wxWindowX11::DoClientToScreen(int *x, int *y) const
@@ -816,10 +818,11 @@ void wxWindowX11::DoClientToScreen(int *x, int *y) const
Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display));
Window thisWindow = (Window) m_clientWindow;
Window childWindow;
int xx = *x;
int yy = *y;
XTranslateCoordinates(display, thisWindow, rootWindow, xx, yy, x, y, &childWindow);
int xx = x ? *x : 0;
int yy = y ? *y : 0;
XTranslateCoordinates(display, thisWindow, rootWindow,
xx, yy, x ? x : &xx, y ? y : &yy,
&childWindow);
}