From f3831c515784b880d8d4b04c125db585ab53b06d Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 13 Nov 2010 15:11:02 +0100 Subject: [PATCH] Turn view->memory into a static variable --- midori/midori-view.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index c34c6846..55ef7c6e 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3051,6 +3051,16 @@ katze_net_object_maybe_unref (gpointer object) g_object_unref (object); } +static GHashTable* midori_view_get_memory (void) +{ + static GHashTable* memory = NULL; + if (!memory) + memory = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, katze_net_object_maybe_unref); + return g_hash_table_ref (memory); + +} + static void midori_view_init (MidoriView* view) { @@ -3060,8 +3070,7 @@ midori_view_init (MidoriView* view) view->mime_type = g_strdup (""); view->icon = NULL; view->icon_uri = NULL; - view->memory = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, katze_net_object_maybe_unref); + view->memory = midori_view_get_memory (); view->progress = 0.0; view->load_status = MIDORI_LOAD_FINISHED; view->minimized = FALSE; @@ -3110,13 +3119,22 @@ midori_view_finalize (GObject* object) midori_view_item_meta_data_changed, view); if (view->thumb_view) + { gtk_widget_destroy (view->thumb_view); + view->thumb_view = NULL; + } katze_assign (view->uri, NULL); katze_assign (view->title, NULL); katze_object_assign (view->icon, NULL); katze_assign (view->icon_uri, NULL); - g_hash_table_destroy (view->memory); + + if (view->memory) + { + g_hash_table_unref (view->memory); + view->memory = NULL; + } + katze_assign (view->statusbar_text, NULL); katze_assign (view->link_uri, NULL); katze_assign (view->selected_text, NULL); -- 2.39.5