Commit f9b80fe1 by Nicolas Capens Committed by Nicolas Capens

Check X11 return status.

We weren't checking the return status of an XGetWindowAttributes() call while checking for a resized window. It appears that it can start to fail possibly due to an out-of-memory situation or the window being destroyed before the EGL surface. Note that the EGL spec does not have a recommendation on how to handle this situation. Generating EGL_BAD_ALLOC is intended for eglCreate* call failures, while EGL_BAD_NATIVE_WINDOW appears to be reserved for calls that take a native window as a parameter. eglSwapBuffers is neither. Bug chromium:819481 Change-Id: I270730567b5179ee43b814e8bd017b601dfbe079 Reviewed-on: https://swiftshader-review.googlesource.com/17708Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent a124f042
......@@ -567,7 +567,7 @@ bool Display::isValidWindow(EGLNativeWindowType window)
XWindowAttributes windowAttributes;
Status status = libX11->XGetWindowAttributes((::Display*)nativeDisplay, window, &windowAttributes);
return status == True;
return status != 0;
}
return false;
#elif defined(__APPLE__)
......
......@@ -269,7 +269,9 @@ bool WindowSurface::checkForResize()
{
#if defined(_WIN32)
RECT client;
if(!GetClientRect(window, &client))
BOOL status = GetClientRect(window, &client);
if(status == 0)
{
return error(EGL_BAD_NATIVE_WINDOW, false);
}
......@@ -281,7 +283,12 @@ bool WindowSurface::checkForResize()
int windowHeight; window->query(window, NATIVE_WINDOW_HEIGHT, &windowHeight);
#elif defined(__linux__)
XWindowAttributes windowAttributes;
libX11->XGetWindowAttributes((::Display*)display->getNativeDisplay(), window, &windowAttributes);
Status status = libX11->XGetWindowAttributes((::Display*)display->getNativeDisplay(), window, &windowAttributes);
if(status == 0)
{
return error(EGL_BAD_NATIVE_WINDOW, false);
}
int windowWidth = windowAttributes.width;
int windowHeight = windowAttributes.height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment