aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-07 20:52:05 -0500
committerTed Gould <ted@canonical.com>2009-04-07 20:52:05 -0500
commiteba8697a790029397d771a3871f431abc4fc0029 (patch)
tree10fd49c9182badfa0b4c816b1d54d4d559c59bc7
parent3e1e51261167c74fa81819cebaafce944e14b310 (diff)
downloadlibayatana-indicator-eba8697a790029397d771a3871f431abc4fc0029.tar.gz
libayatana-indicator-eba8697a790029397d771a3871f431abc4fc0029.tar.bz2
libayatana-indicator-eba8697a790029397d771a3871f431abc4fc0029.zip
Patch from Eitan Isaacson to remove a ref/unref infinite loop that effectively made it so that we kept our objects forever. While we love them, at some point we need to say goodbye.
-rw-r--r--libindicate/server.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libindicate/server.c b/libindicate/server.c
index 1be8ee5..e5bf731 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -610,8 +610,10 @@ indicate_server_add_indicator (IndicateServer * server, IndicateIndicator * indi
{
IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
- g_object_ref(indicator);
- priv->indicators = g_slist_prepend(priv->indicators, indicator);
+ if (g_slist_find (priv->indicators, indicator) != NULL)
+ return;
+
+ priv->indicators = g_slist_prepend(priv->indicators, indicator);
if (!indicate_indicator_is_visible(indicator)) {
priv->num_hidden++;
@@ -631,6 +633,9 @@ indicate_server_remove_indicator (IndicateServer * server, IndicateIndicator * i
{
IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
+ if (g_slist_find (priv->indicators, indicator) == NULL)
+ return;
+
priv->indicators = g_slist_remove(priv->indicators, indicator);
if (indicate_indicator_is_visible(indicator)) {
g_signal_emit(server, signals[INDICATOR_REMOVED], 0, indicate_indicator_get_id(indicator), indicate_indicator_get_indicator_type(indicator), TRUE);
@@ -642,7 +647,6 @@ indicate_server_remove_indicator (IndicateServer * server, IndicateIndicator * i
g_signal_handlers_disconnect_by_func(indicator, indicator_hide_cb, server);
g_signal_handlers_disconnect_by_func(indicator, indicator_modified_cb, server);
- g_object_unref(indicator);
return;
}