ShellTrayManager: fix icon actor memory management

We weren't actually referencing the ShellTrayIcon actors at all
on creation, but would unreference them when they were removed,
causing crashes.

When we reference the actors, use g_object_ref_sink() so that
memory management is consistent whether or not the actors are
subsequently added to a parent actor.

Thanks for Jon McCann for help in tracking this down.

https://bugzilla.gnome.org/show_bug.cgi?id=635141
This commit is contained in:
Owen W. Taylor 2010-11-17 21:30:31 -05:00
parent fa44289dd0
commit 909f2e670a

View File

@ -264,6 +264,8 @@ on_plug_added (GtkSocket *socket,
child = g_hash_table_lookup (manager->priv->icons, socket); child = g_hash_table_lookup (manager->priv->icons, socket);
child->actor = shell_tray_icon_new (SHELL_EMBEDDED_WINDOW (child->window)); child->actor = shell_tray_icon_new (SHELL_EMBEDDED_WINDOW (child->window));
g_object_ref_sink (child->actor);
g_signal_emit (manager, shell_tray_manager_signals[TRAY_ICON_ADDED], 0, g_signal_emit (manager, shell_tray_manager_signals[TRAY_ICON_ADDED], 0,
child->actor); child->actor);
} }