static void initializeGtk(QLibrary* module = 0) { // Ensures missing Gtk initialization in some versions of Adobe's flash player // plugin do not cause crashes. See BR# 40567, 44324, and 44405 for details. if (module) { typedef void *(*gtk_init_ptr)(int*, char***); gtk_init_ptr gtkInit = (gtk_init_ptr)module->resolve("gtk_init"); if (gtkInit) { // Prevent gtk_init() from replacing the X error handlers, since the Gtk // handlers abort when they receive an X error, thus killing the viewer. #ifdef Q_WS_X11 int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0); int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0); #endif gtkInit(0, 0); #ifdef Q_WS_X11 XSetErrorHandler(old_error_handler); XSetIOErrorHandler(old_io_error_handler); #endif return; } } QLibrary library("libgtk-x11-2.0.so.0"); if (library.load()) { typedef void *(*gtk_init_check_ptr)(int*, char***); gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check"); // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure. if (gtkInitCheck) (void) gtkInitCheck(0, 0); } }
static void initializeGTK() { QLibrary library(QLatin1String("libgtk-x11-2.0.so.0")); if (library.load()) { typedef void *(*gtk_init_check_ptr)(int*, char***); gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check")); // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure. if (gtkInitCheck) (void) gtkInitCheck(0, 0); } }