Reset the X error handler after initializing GTK
It turns out that we were setting the error handler to a dummy one in qxcbconnection.cpp, but GTK then overrides it to an handler that calls exit(1) on errors. This causes problems as we are relying on the glXCreateContextAttribsARB call to fail when creating an OpenGL context, so we need to reset the handler after GTK initialization. Change-Id: I9bc3eb2480abfd3740884cb0000b9180d2cf37a5 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>bb10
parent
6b821a3dc8
commit
381566445e
|
|
@ -46,6 +46,8 @@
|
|||
#undef signals
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
const char *QGtk2Theme::name = "gtk2";
|
||||
|
|
@ -62,7 +64,13 @@ static QString gtkSetting(const gchar *propertyName)
|
|||
|
||||
QGtk2Theme::QGtk2Theme()
|
||||
{
|
||||
// gtk_init will reset the Xlib error handler, and that causes
|
||||
// Qt applications to quit on X errors. Therefore, we need to manually restore it.
|
||||
int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL);
|
||||
|
||||
gtk_init(0, 0);
|
||||
|
||||
XSetErrorHandler(oldErrorHandler);
|
||||
}
|
||||
|
||||
QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue