diff options
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-glib-extensions.c | 83 | ||||
-rw-r--r-- | eel/eel-glib-extensions.h | 4 | ||||
-rw-r--r-- | eel/eel-stock-dialogs.c | 3 | ||||
-rw-r--r-- | eel/eel-string.c | 3 |
4 files changed, 2 insertions, 91 deletions
diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c index d6fee1a48..ed9e222f3 100644 --- a/eel/eel-glib-extensions.c +++ b/eel/eel-glib-extensions.c @@ -45,14 +45,6 @@ #define SAFE_SHELL_CHARACTERS "-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" -typedef struct { - GHashTable *hash_table; - char *display_name; - GHFunc foreach_func; -} HashTableToFree; - -static GList *hash_tables_to_free_at_exit; - /** * eel_g_date_new_tm: * @@ -513,81 +505,6 @@ eel_get_system_time (void) return (gint64)tmp.tv_usec + (gint64)tmp.tv_sec * G_GINT64_CONSTANT (1000000); } -static void -print_key_string (gpointer key, gpointer value, gpointer callback_data) -{ - g_assert (callback_data == NULL); - - g_print ("--> %s\n", (char *) key); -} - -static void -free_hash_tables_at_exit (void) -{ - GList *p; - HashTableToFree *hash_table_to_free; - guint size; - - for (p = hash_tables_to_free_at_exit; p != NULL; p = p->next) { - hash_table_to_free = p->data; - - size = g_hash_table_size (hash_table_to_free->hash_table); - if (size != 0) { - if (hash_table_to_free->foreach_func) { - g_print ("\n--- Hash table keys for warning below:\n"); - g_hash_table_foreach (hash_table_to_free->hash_table, - hash_table_to_free->foreach_func, - NULL); - } - g_warning ("\"%s\" hash table still has %u element%s at quit time%s", - hash_table_to_free->display_name, size, - size == 1 ? "" : "s", - hash_table_to_free->foreach_func - ? " (keys above)" : ""); - } - - g_hash_table_destroy (hash_table_to_free->hash_table); - g_free (hash_table_to_free->display_name); - g_free (hash_table_to_free); - } - g_list_free (hash_tables_to_free_at_exit); - hash_tables_to_free_at_exit = NULL; -} - -GHashTable * -eel_g_hash_table_new_free_at_exit (GHashFunc hash_func, - GCompareFunc key_compare_func, - GHFunc foreach_func, - const char *display_name) -{ - GHashTable *hash_table; - HashTableToFree *hash_table_to_free; - - /* FIXME: We can take out the NAUTILUS_DEBUG check once we - * have fixed more of the leaks. For now, it's a bit too noisy - * for the general public. - */ - if (hash_tables_to_free_at_exit == NULL) { - eel_debug_call_at_shutdown (free_hash_tables_at_exit); - } - - hash_table = g_hash_table_new (hash_func, key_compare_func); - - hash_table_to_free = g_new (HashTableToFree, 1); - hash_table_to_free->hash_table = hash_table; - hash_table_to_free->display_name = g_strdup (display_name); - hash_table_to_free->foreach_func = foreach_func; - if (hash_table_to_free->foreach_func == NULL && - hash_func == g_str_hash) { - hash_table_to_free->foreach_func = print_key_string; - } - - hash_tables_to_free_at_exit = g_list_prepend - (hash_tables_to_free_at_exit, hash_table_to_free); - - return hash_table; -} - typedef struct { GList *keys; GList *values; diff --git a/eel/eel-glib-extensions.h b/eel/eel-glib-extensions.h index 6812f8dd2..d32f88024 100644 --- a/eel/eel-glib-extensions.h +++ b/eel/eel-glib-extensions.h @@ -67,10 +67,6 @@ GList * eel_g_object_list_ref (GList * GList * eel_g_object_list_copy (GList *list); /* GHashTable functions */ -GHashTable *eel_g_hash_table_new_free_at_exit (GHashFunc hash_function, - GCompareFunc key_compare_function, - GHFunc foreach_func, - const char *display_name); void eel_g_hash_table_safe_for_each (GHashTable *hash_table, GHFunc callback, gpointer callback_data); diff --git a/eel/eel-stock-dialogs.c b/eel/eel-stock-dialogs.c index fe29ef83d..bc5bb29e5 100644 --- a/eel/eel-stock-dialogs.c +++ b/eel/eel-stock-dialogs.c @@ -271,8 +271,7 @@ eel_timed_wait_start_with_duration (int duration, /* Put in the hash table so we can find it later. */ if (timed_wait_hash_table == NULL) { - timed_wait_hash_table = eel_g_hash_table_new_free_at_exit - (timed_wait_hash, timed_wait_hash_equal, NULL, __FILE__ ": timed wait"); + timed_wait_hash_table = g_hash_table_new (timed_wait_hash, timed_wait_hash_equal); } g_assert (g_hash_table_lookup (timed_wait_hash_table, wait) == NULL); g_hash_table_insert (timed_wait_hash_table, wait, wait); diff --git a/eel/eel-string.c b/eel/eel-string.c index 3d6f9d342..3ecd9f276 100644 --- a/eel/eel-string.c +++ b/eel/eel-string.c @@ -656,8 +656,7 @@ eel_ref_str_get_unique (const char *string) G_LOCK (unique_ref_strs); if (unique_ref_strs == NULL) { unique_ref_strs = - eel_g_hash_table_new_free_at_exit (g_str_hash, g_str_equal, - NULL, "unique eel_ref_str"); + g_hash_table_new (g_str_hash, g_str_equal); } res = g_hash_table_lookup (unique_ref_strs, string); |