[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 12:22:24 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 76b22f9f7bfa6b37c4c181e8f9c5c385cc3326a8
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 08:12:08 2010 +0000

    2010-08-20  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Initialize GDK before loading plugins
            https://bugs.webkit.org/show_bug.cgi?id=44324
    
            Attempt to call gdk_init_check() before loading any plugins.
            This prevents various crashes and freezes in Adobe's Flash plugin.
    
            * plugins/qt/PluginPackageQt.cpp:
            (WebCore::initializeGdkIfPossible):
            (WebCore::PluginPackage::load):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 79f71a8..71d8bdc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-20  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Initialize GDK before loading plugins
+        https://bugs.webkit.org/show_bug.cgi?id=44324
+
+        Attempt to call gdk_init_check() before loading any plugins.
+        This prevents various crashes and freezes in Adobe's Flash plugin.
+
+        * plugins/qt/PluginPackageQt.cpp:
+        (WebCore::initializeGdkIfPossible):
+        (WebCore::PluginPackage::load):
+
 2010-08-20  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Mark Rowe.
diff --git a/WebCore/plugins/qt/PluginPackageQt.cpp b/WebCore/plugins/qt/PluginPackageQt.cpp
index 07149f3..b421b1e 100644
--- a/WebCore/plugins/qt/PluginPackageQt.cpp
+++ b/WebCore/plugins/qt/PluginPackageQt.cpp
@@ -35,8 +35,6 @@
 
 namespace WebCore {
 
-typedef void gtkInitFunc(int *argc, char ***argv);
-
 bool PluginPackage::fetchInfo()
 {
     if (!load())
@@ -92,6 +90,28 @@ static NPError staticPluginQuirkRequiresGtkToolKit_NPN_GetValue(NPP instance, NP
     return NPN_GetValue(instance, variable, value);
 }
 
+static void initializeGdkIfPossible()
+{
+    static bool attemptMade = false;
+
+    if (attemptMade)
+        return;
+
+    attemptMade = true;
+
+    QLibrary library("libgdk-x11-2.0.so.0");
+    if (!library.load())
+        return;
+
+    typedef void *(*gdk_init_check_ptr)(int*, char***);
+    gdk_init_check_ptr gdk_init_check = (gdk_init_check_ptr)library.resolve("gdk_init_check");
+    if (!gdk_init_check)
+        return;
+
+    // NOTE: We're using gdk_init_check() since gdk_init() may exit() on failure.
+    (void) gdk_init_check(0, 0);
+}
+
 bool PluginPackage::load()
 {
     if (m_isLoaded) {
@@ -111,7 +131,6 @@ bool PluginPackage::load()
 
     NP_InitializeFuncPtr NP_Initialize;
     NPError npErr;
-    gtkInitFunc* gtkInit;
 
     NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize");
     m_NPP_Shutdown = (NPP_ShutdownProcPtr)m_module->resolve("NP_Shutdown");
@@ -130,25 +149,8 @@ bool PluginPackage::load()
         m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue;
     }
 
-    // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by
-    // explicitly forcing the initializing of Gtk, i.e. calling gtk_init,
-    // whenver the symbol is present in the plugin library loaded above.
-    // Note that this workaround is based on code from the NSPluginClass ctor
-    // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file.
-    gtkInit = (gtkInitFunc*)m_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
-    }
+    // Try to initialize GDK - some versions of the Flash plugin depend on this.
+    initializeGdkIfPossible();
 
 #if defined(XP_UNIX)
     npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list