gtkwindow: remove delete-event idle function on finalize

Heavy duty can prevent this idle function from being called before
the window is destroyed, so make sure that the source is removed
when the window is finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=723771
This commit is contained in:
Claudio Saavedra 2014-02-06 17:25:55 +02:00
parent 16db6bbccf
commit b91859a19a

View File

@ -156,6 +156,7 @@ struct _GtkWindowPrivate
gchar *wm_role;
guint keys_changed_handler;
guint delete_event_handler;
guint32 initial_timestamp;
@ -1291,6 +1292,8 @@ static gboolean
send_delete_event (gpointer data)
{
GtkWidget *window = data;
GtkWindowPrivate *priv = GTK_WINDOW (window)->priv;
GdkEvent *event;
event = gdk_event_new (GDK_DELETE);
@ -1301,6 +1304,8 @@ send_delete_event (gpointer data)
gtk_main_do_event (event);
gdk_event_free (event);
priv->delete_event_handler = 0;
return G_SOURCE_REMOVE;
}
@ -1322,7 +1327,7 @@ gtk_window_close (GtkWindow *window)
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
return;
gdk_threads_add_idle (send_delete_event, window);
window->priv->delete_event_handler = gdk_threads_add_idle (send_delete_event, window);
}
static void
@ -5273,6 +5278,12 @@ gtk_window_finalize (GObject *object)
priv->keys_changed_handler = 0;
}
if (priv->delete_event_handler)
{
g_source_remove (priv->delete_event_handler);
priv->delete_event_handler = 0;
}
if (priv->screen)
{
g_signal_handlers_disconnect_by_func (priv->screen,
@ -8573,7 +8584,8 @@ close_window_clicked (GtkMenuItem *menuitem,
{
GtkWindow *window = (GtkWindow *)user_data;
send_delete_event (window);
if (window->priv->delete_event_handler == 0)
send_delete_event (window);
}
static void