diff options
Diffstat (limited to 'camel/camel-object.c')
-rw-r--r-- | camel/camel-object.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/camel/camel-object.c b/camel/camel-object.c index 53e7069653..bdb17fa177 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -690,6 +690,7 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, { GSList *hooklist; CamelHookPair *pair; + gpointer old_name, old_hooklist; g_return_if_fail (CAMEL_IS_OBJECT (obj)); g_return_if_fail (name); @@ -703,10 +704,16 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, pair->func = hook; pair->user_data = user_data; - hooklist = g_hash_table_lookup (obj->event_to_hooklist, name); - hooklist = g_slist_prepend (hooklist, pair); - g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), - hooklist); + if (g_hash_table_lookup_extended (obj->event_to_hooklist, name, + &old_name, &old_hooklist)) { + hooklist = g_slist_prepend (old_hooklist, pair); + g_hash_table_insert (obj->event_to_hooklist, old_name, + hooklist); + } else { + hooklist = g_slist_prepend (NULL, pair); + g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), + hooklist); + } } void |