Changeset 61307 in webkit


Ignore:
Timestamp:
Jun 16, 2010 10:38:10 PM (14 years ago)
Author:
Simon Hausmann
Message:

[Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64.
https://bugs.webkit.org/show_bug.cgi?id=40567

Patch by Dawit Alemayehu <adawit@kde.org> on 2010-06-16
Reviewed by Simon Hausmann.

Avoid preventable crashes by ensuring gtk_init() is called in the
flash viewer plugins before calling NP_Initialize.

  • plugins/qt/PluginPackageQt.cpp:

(WebCore::PluginPackage::load):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61306 r61307  
     12010-06-16  Dawit Alemayehu  <adawit@kde.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64.
     6        https://bugs.webkit.org/show_bug.cgi?id=40567
     7
     8        Avoid preventable crashes by ensuring gtk_init() is called in the
     9        flash viewer plugins before calling NP_Initialize.
     10
     11        * plugins/qt/PluginPackageQt.cpp:
     12        (WebCore::PluginPackage::load):
     13
    1142010-06-16  Tony Gentilcore  <tonyg@chromium.org>
    215
  • trunk/WebCore/plugins/qt/PluginPackageQt.cpp

    r58603 r61307  
    3535
    3636namespace WebCore {
     37
     38typedef void gtkInitFunc(int *argc, char ***argv);
    3739
    3840bool PluginPackage::fetchInfo()
     
    110112    NP_InitializeFuncPtr NP_Initialize;
    111113    NPError npErr;
     114    gtkInitFunc* gtkInit;
    112115
    113116    NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize");
     
    126129        // It does so in NP_Initialize with a null instance, therefore it is done this way:
    127130        m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue;
     131    }
     132
     133    // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by
     134    // explicitly forcing the initializing of Gtk, i.e. calling gtk_init,
     135    // whenver the symbol is present in the plugin library loaded above.
     136    // Note that this workaround is based on code from the NSPluginClass ctor
     137    // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file.
     138    gtkInit = (gtkInitFunc*)m_module->resolve("gtk_init");
     139    if (gtkInit) {
     140        // Prevent gtk_init() from replacing the X error handlers, since the Gtk
     141        // handlers abort when they receive an X error, thus killing the viewer.
     142#ifdef Q_WS_X11
     143        int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0);
     144        int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
     145#endif
     146        gtkInit(0, 0);
     147#ifdef Q_WS_X11
     148        XSetErrorHandler(old_error_handler);
     149        XSetIOErrorHandler(old_io_error_handler);
     150#endif
    128151    }
    129152
Note: See TracChangeset for help on using the changeset viewer.