From db5101323d64efc40914f8dc6a33a8cd1a35b0f0 Mon Sep 17 00:00:00 2001 From: arturo Date: Wed, 24 Jul 2013 20:03:31 +0200 Subject: [PATCH] x11_window: getPosition, check child!=NULL to avoid crashes --- src/x11_window.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index 9258ccb7..99d015e1 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -290,7 +290,7 @@ static GLboolean createWindow(_GLFWwindow* window, if(_glfw.x11.XdndAware!=None) { //Announce XDND support - unsigned long version=5; + Atom version=5; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1); } @@ -1109,15 +1109,18 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { Window child; int x, y; - int left; - int top; + int left=0; + int top=0; XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root, 0, 0, &x, &y, &child); - XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child, + if(child) + { + XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child, 0, 0, &left, &top, &child); + } if (xpos)