Changeset 65728 in webkit
- Timestamp:
- Aug 20, 2010 1:12:08 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65727 r65728 1 2010-08-20 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Initialize GDK before loading plugins 6 https://bugs.webkit.org/show_bug.cgi?id=44324 7 8 Attempt to call gdk_init_check() before loading any plugins. 9 This prevents various crashes and freezes in Adobe's Flash plugin. 10 11 * plugins/qt/PluginPackageQt.cpp: 12 (WebCore::initializeGdkIfPossible): 13 (WebCore::PluginPackage::load): 14 1 15 2010-08-20 Dan Bernstein <mitz@apple.com> 2 16 -
trunk/WebCore/plugins/qt/PluginPackageQt.cpp
r61307 r65728 35 35 36 36 namespace WebCore { 37 38 typedef void gtkInitFunc(int *argc, char ***argv);39 37 40 38 bool PluginPackage::fetchInfo() … … 93 91 } 94 92 93 static void initializeGdkIfPossible() 94 { 95 static bool attemptMade = false; 96 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); 113 } 114 95 115 bool PluginPackage::load() 96 116 { … … 112 132 NP_InitializeFuncPtr NP_Initialize; 113 133 NPError npErr; 114 gtkInitFunc* gtkInit;115 134 116 135 NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize"); … … 131 150 } 132 151 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 151 } 152 // Try to initialize GDK - some versions of the Flash plugin depend on this. 153 initializeGdkIfPossible(); 152 154 153 155 #if defined(XP_UNIX)
Note: See TracChangeset
for help on using the changeset viewer.