[gtk+] GtkStyleContext: don't use disconnect_by_func()
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkStyleContext: don't use disconnect_by_func()
- Date: Wed, 29 Jan 2014 22:06:14 +0000 (UTC)
commit 8e19b765433978fdec02a38597caac40345a7eb8
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Jan 28 19:47:05 2014 +0100
GtkStyleContext: don't use disconnect_by_func()
disconnect_by_func() is slow, and this becomes particularly evident
when disposing a number of widgets (and their associated style
context) at once, such as when using a language binding which
uses a GC.
https://bugzilla.gnome.org/show_bug.cgi?id=723183
gtk/gtkstylecontext.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 18ef29a..859a007 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -355,8 +355,8 @@ struct _GtkStyleContextPrivate
{
GdkScreen *screen;
+ guint cascade_changed_id;
GtkStyleCascade *cascade;
-
GtkStyleContext *parent;
GSList *children;
GtkWidget *widget;
@@ -684,21 +684,20 @@ gtk_style_context_set_cascade (GtkStyleContext *context,
if (priv->cascade == cascade)
return;
- if (cascade)
+ if (priv->cascade)
{
- g_object_ref (cascade);
- g_signal_connect (cascade,
- "-gtk-private-changed",
- G_CALLBACK (gtk_style_context_cascade_changed),
- context);
+ g_signal_handler_disconnect (priv->cascade, priv->cascade_changed_id);
+ priv->cascade_changed_id = 0;
+ g_object_unref (priv->cascade);
}
- if (priv->cascade)
+ if (cascade)
{
- g_signal_handlers_disconnect_by_func (priv->cascade,
- gtk_style_context_cascade_changed,
- context);
- g_object_unref (priv->cascade);
+ g_object_ref (cascade);
+ priv->cascade_changed_id = g_signal_connect (cascade,
+ "-gtk-private-changed",
+ G_CALLBACK (gtk_style_context_cascade_changed),
+ context);
}
priv->cascade = cascade;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]