]> spindle.queued.net Git - midori/commitdiff
Turn view->memory into a static variable
authorChristian Dywan <christian@twotoasts.de>
Sat, 13 Nov 2010 14:11:02 +0000 (15:11 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 13 Nov 2010 14:20:46 +0000 (15:20 +0100)
midori/midori-view.c

index c34c684693b37922230d149af93e7c6ffbf74651..55ef7c6e3a23530356e8a502a886f6e3b883db65 100644 (file)
@@ -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);