forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
71b17b4756
commit
8e19b76543
@ -355,8 +355,8 @@ struct _GtkStyleContextPrivate
|
|||||||
{
|
{
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
|
||||||
|
guint cascade_changed_id;
|
||||||
GtkStyleCascade *cascade;
|
GtkStyleCascade *cascade;
|
||||||
|
|
||||||
GtkStyleContext *parent;
|
GtkStyleContext *parent;
|
||||||
GSList *children;
|
GSList *children;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
@ -684,21 +684,20 @@ gtk_style_context_set_cascade (GtkStyleContext *context,
|
|||||||
if (priv->cascade == cascade)
|
if (priv->cascade == cascade)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (priv->cascade)
|
||||||
|
{
|
||||||
|
g_signal_handler_disconnect (priv->cascade, priv->cascade_changed_id);
|
||||||
|
priv->cascade_changed_id = 0;
|
||||||
|
g_object_unref (priv->cascade);
|
||||||
|
}
|
||||||
|
|
||||||
if (cascade)
|
if (cascade)
|
||||||
{
|
{
|
||||||
g_object_ref (cascade);
|
g_object_ref (cascade);
|
||||||
g_signal_connect (cascade,
|
priv->cascade_changed_id = g_signal_connect (cascade,
|
||||||
"-gtk-private-changed",
|
"-gtk-private-changed",
|
||||||
G_CALLBACK (gtk_style_context_cascade_changed),
|
G_CALLBACK (gtk_style_context_cascade_changed),
|
||||||
context);
|
context);
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->cascade)
|
|
||||||
{
|
|
||||||
g_signal_handlers_disconnect_by_func (priv->cascade,
|
|
||||||
gtk_style_context_cascade_changed,
|
|
||||||
context);
|
|
||||||
g_object_unref (priv->cascade);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->cascade = cascade;
|
priv->cascade = cascade;
|
||||||
|
Loading…
Reference in New Issue
Block a user