Commit 45838e33 by Corentin Wallez

WindowSurfaceGLX: ignore X11 when destroying windows

Chromium seems to destroy the parent window before calling asking to destroy the EGL surface. We don't want to generate a BadWindow X11 error in this case so we ignore errors when calling XDestroyWindow. BUG=angleproject:1281 Change-Id: Ie63d188b6206c0ff3b5ac6a5a874e7d6018489e4 Reviewed-on: https://chromium-review.googlesource.com/322361 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 07651e24
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
namespace rx namespace rx
{ {
static int IgnoreX11Errors(Display *, XErrorEvent *)
{
return 0;
}
WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx, WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx,
DisplayGLX *glxDisplay, DisplayGLX *glxDisplay,
RendererGL *renderer, RendererGL *renderer,
...@@ -44,7 +49,14 @@ WindowSurfaceGLX::~WindowSurfaceGLX() ...@@ -44,7 +49,14 @@ WindowSurfaceGLX::~WindowSurfaceGLX()
if (mWindow) if (mWindow)
{ {
// When destroying the window, it may happen that the window has already been
// destroyed by the application (this happens in Chromium). There is no way to
// atomically check that a window exists and to destroy it so instead we call
// XDestroyWindow, ignoring any errors.
auto oldErrorHandler = XSetErrorHandler(IgnoreX11Errors);
XDestroyWindow(mDisplay, mWindow); XDestroyWindow(mDisplay, mWindow);
XSync(mDisplay, False);
XSetErrorHandler(oldErrorHandler);
} }
mGLXDisplay->syncXCommands(); mGLXDisplay->syncXCommands();
......
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