bug 482091. patch from Jeff Muizelaar. fix cash on maemo with plugins
authorStuart Parmenter <pavlov@pavlov.net>
Thu, 12 Mar 2009 08:11:10 -0700
changeset 26102 a9c7c01d5ed80370aa3d24b41f7bfb6dfd738653
parent 26101 501d8a053dc93470578c72f5e7999e1b7d1e7b75
child 26103 5c1e7c779b6edc8ff912001990edc579f80597f4
push idunknown
push userunknown
push dateunknown
bugs482091
milestone1.9.2a1pre
bug 482091. patch from Jeff Muizelaar. fix cash on maemo with plugins
modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
--- a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
+++ b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
@@ -293,16 +293,17 @@ nsresult nsPluginNativeWindowGtk2::Creat
   GdkVisual* gdkVisual = gdk_drawable_get_visual(gdkWindow);
   mWsInfo.visual = GDK_VISUAL_XVISUAL(gdkVisual);
   mWsInfo.depth = gdkVisual->depth;
 
   return NS_OK;
 }
 
 #ifdef MOZ_COMPOSITED_PLUGINS
+#include <dlfcn.h>
 nsresult nsPluginNativeWindowGtk2::CreateXCompositedWindow() {
   NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
 
   mParentWindow = gtk_window_new(GTK_WINDOW_POPUP);
   mSocketWidget = gtk_socket_new();
   GdkWindow *parent_win = mParentWindow->window;
 
   //attach the socket to the container widget
@@ -353,16 +354,27 @@ nsresult nsPluginNativeWindowGtk2::Creat
     int junk;
     if (!XDamageQueryExtension (GDK_DISPLAY (), &xdamage_event_base, &junk))
       printf ("This requires the XDamage extension");
 
     mDamage = XDamageCreate(GDK_DISPLAY(), (Drawable)window, XDamageReportNonEmpty);
     XCompositeRedirectWindow (GDK_DISPLAY(),
         (Drawable)window,
         CompositeRedirectManual);
+
+    /* this is a hack to avoid having flash causing a crash when it is unloaded.
+     * libplayback sets up dbus_connection_filters. When flash is unloaded it takes
+     * libplayback with it, however the connection filters are not removed
+     * which causes a crash when dbus tries to execute them. dlopening libplayback
+     * ensures that those functions stay around even after flash is gone. */
+    static void *libplayback_handle;
+    if (!libplayback_handle) {
+      libplayback_handle = dlopen("libplayback-1.so.0", RTLD_NOW);
+    }
+
   }
 
   // Fill out the ws_info structure.
   // (The windowless case is done in nsObjectFrame.cpp.)
   GdkWindow *gdkWindow = gdk_window_lookup((XID)window);
   mWsInfo.display = GDK_WINDOW_XDISPLAY(gdkWindow);
   mWsInfo.colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(gdkWindow));
   GdkVisual* gdkVisual = gdk_drawable_get_visual(gdkWindow);