Fix possible crasher when theme changes

When the theme or screen changes, we need to make sure that
the previous handler for the theme-changed signal is disconnected
to avoid the callback being called when the panel has been unloaded.

https://bugzilla.redhat.com/show_bug.cgi?id=610289
This commit is contained in:
Bastien Nocera 2010-07-22 15:56:26 +01:00
parent 576f3895f7
commit b8e36d5658
3 changed files with 10 additions and 1 deletions

View file

@ -72,6 +72,13 @@ cc_default_applications_panel_dispose (GObject *object)
g_object_unref (priv->capplet->gconf);
gnome_da_xml_free (priv->capplet);
if (priv->capplet->theme_changed_id > 0)
{
g_signal_handler_disconnect (priv->capplet->icon_theme,
priv->capplet->theme_changed_id);
priv->capplet->theme_changed_id = 0;
}
priv->capplet = NULL;
}

View file

@ -286,7 +286,7 @@ screen_changed_cb (GtkWidget *widget, GdkScreen *screen, GnomeDACapplet *capplet
if (capplet->icon_theme != NULL) {
g_signal_handlers_disconnect_by_func (capplet->icon_theme, theme_changed_cb, capplet);
}
g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet);
capplet->theme_changed_id = g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet);
theme_changed_cb (theme, capplet);
capplet->icon_theme = theme;

View file

@ -121,6 +121,8 @@ struct _GnomeDACapplet {
GList *media_players;
GList *visual_ats;
GList *mobility_ats;
guint theme_changed_id;
};
void gnome_default_applications_panel_init (GnomeDACapplet *capplet);