mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-20 02:10:12 +00:00
Fix a refcounting issues in GtkPlug
When the foreign window already has a GdkWindow, we forget to take an extra references, leading to crashes later on. Patch by Karl Tomlinson, bug 607061.
This commit is contained in:
parent
2c53b675c3
commit
6247ef7a32
@ -326,6 +326,7 @@ _gtk_plug_add_to_socket (GtkPlug *plug,
|
|||||||
socket_->plug_widget = widget;
|
socket_->plug_widget = widget;
|
||||||
|
|
||||||
plug->socket_window = GTK_WIDGET (socket_)->window;
|
plug->socket_window = GTK_WIDGET (socket_)->window;
|
||||||
|
g_object_ref (plug->socket_window);
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (widget))
|
if (GTK_WIDGET_REALIZED (widget))
|
||||||
{
|
{
|
||||||
@ -411,8 +412,11 @@ _gtk_plug_remove_from_socket (GtkPlug *plug,
|
|||||||
socket_->same_app = FALSE;
|
socket_->same_app = FALSE;
|
||||||
|
|
||||||
plug->same_app = FALSE;
|
plug->same_app = FALSE;
|
||||||
|
if (plug->socket_window != NULL)
|
||||||
|
{
|
||||||
|
g_object_unref (plug->socket_window);
|
||||||
plug->socket_window = NULL;
|
plug->socket_window = NULL;
|
||||||
|
}
|
||||||
gtk_plug_set_is_child (plug, FALSE);
|
gtk_plug_set_is_child (plug, FALSE);
|
||||||
|
|
||||||
g_signal_emit_by_name (socket_, "plug-removed", &result);
|
g_signal_emit_by_name (socket_, "plug-removed", &result);
|
||||||
@ -468,11 +472,9 @@ gtk_plug_construct_for_display (GtkPlug *plug,
|
|||||||
gpointer user_data = NULL;
|
gpointer user_data = NULL;
|
||||||
|
|
||||||
plug->socket_window = gdk_window_lookup_for_display (display, socket_id);
|
plug->socket_window = gdk_window_lookup_for_display (display, socket_id);
|
||||||
|
|
||||||
if (plug->socket_window)
|
if (plug->socket_window)
|
||||||
|
{
|
||||||
gdk_window_get_user_data (plug->socket_window, &user_data);
|
gdk_window_get_user_data (plug->socket_window, &user_data);
|
||||||
else
|
|
||||||
plug->socket_window = gdk_window_foreign_new_for_display (display, socket_id);
|
|
||||||
|
|
||||||
if (user_data)
|
if (user_data)
|
||||||
{
|
{
|
||||||
@ -484,6 +486,11 @@ gtk_plug_construct_for_display (GtkPlug *plug,
|
|||||||
plug->socket_window = NULL;
|
plug->socket_window = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_object_ref (plug->socket_window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
plug->socket_window = gdk_window_foreign_new_for_display (display, socket_id);
|
||||||
|
|
||||||
if (plug->socket_window) {
|
if (plug->socket_window) {
|
||||||
g_signal_emit (plug, plug_signals[EMBEDDED], 0);
|
g_signal_emit (plug, plug_signals[EMBEDDED], 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user