summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2014-10-29 13:05:07 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-10-29 13:23:01 +0100
commit363f27a942aaf9b291721512fce4c0b75f85e82b (patch)
treeecfccde418b9198dee95d8b58d0296c4db7fd10a
parent421dfcdd17265f540367bae9ad8325b3df6cf72a (diff)
OpenGLContext: Add locking/sync around X errors
In order to manipulate the (global) X error handler without races, we need to lock the X11 display, and also push an XSync through between locking and changing the error handler, so we don't catch unrelated errors. Change-Id: Ic970224c98c05c6e13aadd781f8275cde5f37dd0
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index e5b5c6f5b22d..787e5e5448dd 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -656,6 +656,8 @@ bool OpenGLContext::ImplInit()
if( glXSwapInterval ) {
int (*oldHandler)(Display* /*dpy*/, XErrorEvent* /*evnt*/);
+ XLockDisplay(m_aGLWin.dpy);
+ XSync(m_aGLWin.dpy, false);
// replace error handler temporarily
oldHandler = XSetErrorHandler( oglErrorHandler );
@@ -674,6 +676,7 @@ bool OpenGLContext::ImplInit()
// restore the error handler
XSetErrorHandler( oldHandler );
+ XUnlockDisplay(m_aGLWin.dpy);
}
}