From c9b079cbb5f0a60808e8602ae4ac892091b18a8b Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Fri, 12 Jul 2013 11:07:18 +0200 Subject: [PATCH] StWidget: use a handler id to disconnect the callback g_signal_handlers_disconnect_by_func() is much more expensive than g_signal_handler_disconnect(), so use the latter. https://bugzilla.gnome.org/show_bug.cgi?id=704077 --- src/st/st-widget.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/st/st-widget.c b/src/st/st-widget.c index 4cbe0ec29..d74f8ed60 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -67,6 +67,8 @@ struct _StWidgetPrivate gboolean hover : 1; gboolean can_focus : 1; + gulong texture_file_changed_id; + AtkObject *accessible; AtkRole accessible_role; AtkStateSet *local_state_set; @@ -362,9 +364,11 @@ st_widget_dispose (GObject *gobject) priv->label_actor = NULL; } - g_signal_handlers_disconnect_by_func (st_texture_cache_get_default (), - st_widget_texture_cache_changed, - actor); + if (priv->texture_file_changed_id != 0) + { + g_signal_handler_disconnect (st_texture_cache_get_default (), priv->texture_file_changed_id); + priv->texture_file_changed_id = 0; + } g_clear_object (&priv->prev_first_child); g_clear_object (&priv->prev_last_child); @@ -1552,8 +1556,8 @@ st_widget_init (StWidget *actor) g_signal_connect (actor, "notify::first-child", G_CALLBACK (st_widget_first_child_notify), NULL); g_signal_connect (actor, "notify::last-child", G_CALLBACK (st_widget_last_child_notify), NULL); - g_signal_connect (st_texture_cache_get_default (), "texture-file-changed", - G_CALLBACK (st_widget_texture_cache_changed), actor); + priv->texture_file_changed_id = g_signal_connect (st_texture_cache_get_default (), "texture-file-changed", + G_CALLBACK (st_widget_texture_cache_changed), actor); for (i = 0; i < G_N_ELEMENTS (priv->paint_states); i++) st_theme_node_paint_state_init (&priv->paint_states[i]);