From c7eee08171b40c224564a5fffd3a4c5f0e32f7c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 13:13:21 -0500 Subject: We want the key not the value. --- libindicator/indicator-service.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'libindicator') diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index d0f8ed2..55fb650 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -395,12 +395,20 @@ try_and_get_name (IndicatorService * service) return; } +typedef struct _hash_table_find_t hash_table_find_t; +struct _hash_table_find_t { + GObject * proxy; + gchar * name; +}; + /* Look in the hash table for the proxy, as it won't give us its name. */ static gboolean hash_table_find (gpointer key, gpointer value, gpointer user_data) { - if (value == user_data) { + hash_table_find_t * finddata = (hash_table_find_t *)user_data; + if (value == finddata->proxy) { + finddata->name = key; return TRUE; } return FALSE; @@ -414,8 +422,11 @@ proxy_destroyed (GObject * proxy, gpointer user_data) g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data); - gchar * name = (gchar *)g_hash_table_find(priv->watchers, hash_table_find, proxy); - unwatch_core(INDICATOR_SERVICE(user_data), name); + hash_table_find_t finddata = {0}; + finddata.proxy = proxy; + + g_hash_table_find(priv->watchers, hash_table_find, &finddata); + unwatch_core(INDICATOR_SERVICE(user_data), finddata.name); return; } -- cgit v1.2.3