Added patch for mozbz#1205199

This commit is contained in:
Martin Stransky 2016-02-11 13:34:29 +01:00
parent bc5e1e5ef3
commit 93db231423
2 changed files with 112 additions and 1 deletions

View File

@ -78,7 +78,7 @@
Summary: Mozilla Firefox Web browser Summary: Mozilla Firefox Web browser
Name: firefox Name: firefox
Version: 44.0.2 Version: 44.0.2
Release: 2%{?pre_tag}%{?dist} Release: 3%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/projects/firefox/ URL: https://www.mozilla.org/projects/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet Group: Applications/Internet
@ -119,6 +119,7 @@ Patch223: rhbz-1291190-appchooser-crash.patch
# Upstream patches # Upstream patches
Patch300: mozilla-1234026.patch Patch300: mozilla-1234026.patch
Patch301: mozilla-1205199.patch
# Gtk3 upstream patches # Gtk3 upstream patches
@ -269,6 +270,7 @@ cd %{tarballdir}
%patch223 -p1 -b .appchooser-crash %patch223 -p1 -b .appchooser-crash
%patch300 -p1 -b .1234026 %patch300 -p1 -b .1234026
%patch301 -p1 -b .1205199
%patch500 -p1 %patch500 -p1
%patch501 -p1 %patch501 -p1
@ -769,6 +771,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#--------------------------------------------------------------------- #---------------------------------------------------------------------
%changelog %changelog
* Thu Feb 11 2016 Martin Stransky <stransky@redhat.com> - 44.0.2-3
- Added patch for mozbz#1205199
* Thu Feb 11 2016 Martin Stransky <stransky@redhat.com> - 44.0.2-2 * Thu Feb 11 2016 Martin Stransky <stransky@redhat.com> - 44.0.2-2
- Update to 44.0.2 (B3) - Update to 44.0.2 (B3)

106
mozilla-1205199.patch Normal file
View File

@ -0,0 +1,106 @@
diff --git a/dom/plugins/base/nsPluginNativeWindowGtk.cpp b/dom/plugins/base/nsPluginNativeWindowGtk.cpp
--- a/dom/plugins/base/nsPluginNativeWindowGtk.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowGtk.cpp
@@ -19,16 +19,17 @@
#if (GTK_MAJOR_VERSION == 3)
#include <gtk/gtkx.h>
#else
#include "gtk2xtbin.h"
#endif
#include "mozilla/X11Util.h"
+static void plug_added_cb(GtkWidget *widget, gpointer data);
static gboolean plug_removed_cb (GtkWidget *widget, gpointer data);
static void socket_unrealize_cb (GtkWidget *widget, gpointer data);
nsPluginNativeWindowGtk::nsPluginNativeWindowGtk() : nsPluginNativeWindow()
{
// initialize the struct fields
window = nullptr;
x = 0;
@@ -158,16 +159,19 @@ nsresult nsPluginNativeWindowGtk::Create
//attach the socket to the container widget
gtk_widget_set_parent_window(mSocketWidget, parent_win);
// enable/disable focus event handlers,
// see plugin_window_filter_func() for details
g_object_set_data(G_OBJECT(mSocketWidget), "enable-xt-focus", (void *)aEnableXtFocus);
+ g_signal_connect(mSocketWidget, "plug_added",
+ G_CALLBACK(plug_added_cb), nullptr);
+
// Make sure to handle the plug_removed signal. If we don't the
// socket will automatically be destroyed when the plug is
// removed, which means we're destroying it more than once.
// SYNTAX ERROR.
g_signal_connect(mSocketWidget, "plug_removed",
G_CALLBACK(plug_removed_cb), nullptr);
g_signal_connect(mSocketWidget, "unrealize",
@@ -273,16 +277,42 @@ nsresult nsPluginNativeWindowGtk::Create
// Leave mWsInfo.type = 0 - Who knows what this is meant to be?
XFlush(mWsInfo.display);
return NS_OK;
}
#endif
+static void
+plug_window_finalize_cb(gpointer socket, GObject* plug_window)
+{
+ g_object_unref(socket);
+}
+
+static void
+plug_added_cb(GtkWidget *socket, gpointer data)
+{
+ // The plug window has been embedded, and gtk_socket_add_window() has added
+ // a filter to the socket's plug_window, passing the socket as data for the
+ // filter, so the socket must live as long as events may be received on the
+ // plug window.
+ //
+ // https://git.gnome.org/browse/gtk+/tree/gtk/gtksocket.c?h=3.18.7#n1124
+ g_object_ref(socket);
+ // When the socket is unrealized, perhaps during gtk_widget_destroy() from
+ // ~nsPluginNativeWindowGtk, the plug is removed. The plug in the child
+ // process then destroys its widget and window. When the browser process
+ // receives the DestroyNotify event for the plug window, GDK releases its
+ // reference to plugWindow. This is typically the last reference and so the
+ // weak ref callback triggers release of the socket.
+ GdkWindow* plugWindow = gtk_socket_get_plug_window(GTK_SOCKET(socket));
+ g_object_weak_ref(G_OBJECT(plugWindow), plug_window_finalize_cb, socket);
+}
+
/* static */
gboolean
plug_removed_cb (GtkWidget *widget, gpointer data)
{
// Gee, thanks for the info!
return TRUE;
}
diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -384,16 +384,17 @@ STUB(gtk_selection_data_targets_include_
STUB(gtk_separator_get_type)
STUB(gtk_separator_menu_item_new)
STUB(gtk_separator_tool_item_new)
STUB(gtk_settings_get_default)
STUB(gtk_settings_get_for_screen)
STUB(gtk_socket_add_id)
STUB(gtk_socket_get_id)
STUB(gtk_socket_get_type)
+STUB(gtk_socket_get_plug_window)
STUB(gtk_socket_new)
STUB(gtk_spin_button_new)
STUB(gtk_statusbar_new)
STUB(gtk_style_lookup_icon_set)
STUB(gtk_table_attach)
STUB(gtk_table_get_type)
STUB(gtk_table_new)
STUB(gtk_target_list_add)