Commit 77d3c8af authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Peter Hutterer
Browse files

Fix registering error handlers



It looks like xorg-gtest and libX11 have a different idea of where the error
handler pointer is supposed to point at.  Check for the default handler
returned from XSet*ErrorHandler by setting a NULL error handler first.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent e1168f49
......@@ -436,19 +436,27 @@ static int _x_io_error_handler(Display *dpy)
void xorg::testing::XServer::RegisterXIOErrorHandler()
{
XIOErrorHandler old_handler;
old_handler = XSetIOErrorHandler(_x_io_error_handler);
XIOErrorHandler old_handler, def_handler;
if (old_handler != _XDefaultIOError)
old_handler = XSetIOErrorHandler(NULL);
def_handler = XSetIOErrorHandler(_x_io_error_handler);
if (old_handler != def_handler &&
old_handler != _XDefaultIOError &&
old_handler != _x_io_error_handler)
XSetIOErrorHandler(old_handler);
}
void xorg::testing::XServer::RegisterXErrorHandler()
{
XErrorHandler old_handler;
old_handler = XSetErrorHandler(_x_error_handler);
XErrorHandler old_handler, def_handler;
old_handler = XSetErrorHandler(NULL);
def_handler = XSetErrorHandler(_x_error_handler);
if (old_handler != _XDefaultError)
if (old_handler != def_handler &&
old_handler != _XDefaultError &&
old_handler != _x_error_handler)
XSetErrorHandler(old_handler);
}
......
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