Changeset 66017 in webkit


Ignore:
Timestamp:
Aug 25, 2010 9:33:34 AM (14 years ago)
Author:
Girish Ramakrishnan
Message:

2010-08-25 Dawit Alemayehu <adawit@kde.org>

Reviewed by Ariya Hidayat.

Proper workaround for missing Gtk initialization in Adobe's flash plugins.
https://bugs.webkit.org/show_bug.cgi?id=44405

  • plugins/qt/PluginPackageQt.cpp: (WebCore::initializeGtk): (WebCore::PluginPackage::load):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66015 r66017  
     12010-08-25  Dawit Alemayehu  <adawit@kde.org>
     2
     3        Reviewed by Ariya Hidayat.
     4
     5        Proper workaround for missing Gtk initialization in Adobe's flash plugins.
     6        https://bugs.webkit.org/show_bug.cgi?id=44405
     7
     8        * plugins/qt/PluginPackageQt.cpp:
     9        (WebCore::initializeGtk):
     10        (WebCore::PluginPackage::load):
     11
    1122010-08-25  Ilya Tikhonovsky  <loislo@chromium.org>
    213
  • trunk/WebCore/plugins/qt/PluginPackageQt.cpp

    r65728 r66017  
    9191}
    9292
    93 static void initializeGdkIfPossible()
     93static void initializeGtk(QLibrary* module = 0)
    9494{
    95     static bool attemptMade = false;
     95    // Ensures missing Gtk initialization in some versions of Adobe's flash player
     96    // plugin do not cause crashes. See BR# 40567, 44324, and 44405 for details. 
     97    if (module) {
     98        typedef void *(*gtk_init_ptr)(int*, char***);
     99        gtk_init_ptr gtkInit = (gtk_init_ptr)module->resolve("gtk_init");
     100        if (gtkInit) {
     101            // Prevent gtk_init() from replacing the X error handlers, since the Gtk
     102            // handlers abort when they receive an X error, thus killing the viewer.
     103#ifdef Q_WS_X11
     104            int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0);
     105            int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
     106#endif
     107            gtkInit(0, 0);
     108#ifdef Q_WS_X11
     109            XSetErrorHandler(old_error_handler);
     110            XSetIOErrorHandler(old_io_error_handler);
     111#endif
     112            return;
     113        }
     114    }
    96115
    97     if (attemptMade)
    98         return;
    99 
    100     attemptMade = true;
    101 
    102     QLibrary library("libgdk-x11-2.0.so.0");
    103     if (!library.load())
    104         return;
    105 
    106     typedef void *(*gdk_init_check_ptr)(int*, char***);
    107     gdk_init_check_ptr gdk_init_check = (gdk_init_check_ptr)library.resolve("gdk_init_check");
    108     if (!gdk_init_check)
    109         return;
    110 
    111     // NOTE: We're using gdk_init_check() since gdk_init() may exit() on failure.
    112     (void) gdk_init_check(0, 0);
     116    QLibrary library("libgtk-x11-2.0.so.0");
     117    if (library.load()) {
     118        typedef void *(*gtk_init_check_ptr)(int*, char***);
     119        gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
     120        // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure.
     121        if (gtkInitCheck)
     122            (void) gtkInitCheck(0, 0);
     123    }
    113124}
    114125
     
    148159        // It does so in NP_Initialize with a null instance, therefore it is done this way:
    149160        m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue;
     161        // Workaround Adobe's failure to properly initialize Gtk in some versions
     162        // of their flash player plugin.
     163        initializeGtk();
     164    } else if (m_path.contains("flashplayer")) {
     165        // Workaround Adobe's failure to properly initialize Gtk in some versions
     166        // of their flash player plugin.
     167        initializeGtk(m_module);
    150168    }
    151 
    152     // Try to initialize GDK - some versions of the Flash plugin depend on this.
    153     initializeGdkIfPossible();
    154169
    155170#if defined(XP_UNIX)
Note: See TracChangeset for help on using the changeset viewer.