diff options
author | Darin Adler <darin@src.gnome.org> | 2000-09-23 01:21:29 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-09-23 01:21:29 +0000 |
commit | cbf7c584a49fda3d557657fc10e5ef80c8e89a6a (patch) | |
tree | 617ee74b940187855103d8a61db1b0a46584cb48 /components/tree | |
parent | bb556e5bdbc2b718340f76575ed6b3100c23e570 (diff) | |
download | nautilus-cbf7c584a49fda3d557657fc10e5ef80c8e89a6a.tar.gz |
Storage leak fixes. Today I concentrated on leaks that happen
when you change views from Icon to List View and back.
* components/tree/nautilus-tree-view.c:
(nautilus_tree_view_insert_model_node): Unref a pixmap and bitmap,
free a string.
(nautilus_tree_view_update_model_node): Unref a pixmap and bitmap,
free a string.
(notify_node_seen): Free a string.
(nautilus_tree_view_uri_to_name): Removed extra g_strdup.
* libnautilus-extensions/nautilus-glib-extensions.c:
(free_hash_tables_at_exit): Free a list.
* libnautilus-extensions/nautilus-list.c: (draw_cell): Skip the
excess work of re-getting the pixmap and bitmap, not using them,
and leaking them.
* libnautilus-extensions/nautilus-preferences.c:
(preferences_hash_node_remove_callback): Free a list.
* src/file-manager/fm-directory-view.c: (queue_pending_files):
Free a list.
* src/file-manager/fm-icon-view.c: (get_icon_text_callback):
Free a string in all code paths (was freed in some before).
* src/file-manager/fm-list-view.c: (add_to_list): Free the column
text in a way that works even though some columns have NULL.
(install_row_images): Unref a pixmap and bitmap.
* libnautilus-extensions/nautilus-scalable-font.c:
(destroy_global_rsvg_ft_context),
(initialize_global_stuff_if_needed): Free the rsvg_ft font cache
at exit.
* libnautilus-extensions/nautilus-theme.c: (free_last_theme),
(nautilus_theme_get_theme_data): Free the cached theme XML
document at exit.
* components/help/converters/gnome-db2html2/gdb3html.c:
(remove_head), (start_element), (end_element), (cdata_block):
* components/tree/nautilus-tree-model.c:
(nautilus_tree_model_for_each_postorder),
(nautilus_tree_model_monitor_add):
* libnautilus-extensions/nautilus-directory-async.c:
(remove_monitor_link), (dequeue_pending_idle_callback),
(remove_callback_link_keep_data), (remove_callback_link):
* libnautilus-extensions/nautilus-drag.c:
(nautilus_drag_file_receive_dropped_keyword):
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_get_change):
* libnautilus-extensions/nautilus-thumbnails.c:
(check_for_thumbnails):
* src/file-manager/fm-properties-window.c:
(property_button_toggled):
* src/nautilus-window-manage-views.c: (handle_go_back),
(handle_go_forward):
* src/nautilus-window.c: (nautilus_add_to_history_list):
Fixed a bunch of callers of g_list_remove_link to also free the
removed link. This seems to be an error-prone API from glib.
About half of the callers had it wrong.
* src/nautilus-bookmark-list.c:
(nautilus_bookmark_list_delete_item_at),
(nautilus_bookmark_list_delete_items_with_uri):
* src/nautilus-sidebar.c: (receive_dropped_keyword):
Changed to use g_list_free_1 for clarity.
* src/nautilus-location-bar.c: Coding style tweaks.
* src/nautilus-main.c: (main): Run the self-checks a second time
if they succeed the first time. More thorough check this way (make
sure the test works even after it's been run once), and better to
notice one-time vs. per-test leaks.
* tools/leak-checker/nautilus-leak-checker.c: (g_slist_alloc),
(g_slist_free), (g_slist_free_1), (g_mem_chunk_new),
(g_mem_chunk_destroy), (g_mem_chunk_alloc), (g_mem_chunk_alloc0),
(g_mem_chunk_free), (g_mem_chunk_clean), (g_mem_chunk_reset),
(g_mem_chunk_print): Made the GSList and GMemChunk code dumb down
when using the leak checker.
* tools/leak-checker/nautilus-leak-checker.c: Added more symbols
of "known to leak" functions so we can see the real leakers.
Diffstat (limited to 'components/tree')
-rw-r--r-- | components/tree/nautilus-tree-model.c | 14 | ||||
-rw-r--r-- | components/tree/nautilus-tree-view.c | 19 |
2 files changed, 26 insertions, 7 deletions
diff --git a/components/tree/nautilus-tree-model.c b/components/tree/nautilus-tree-model.c index ad71ae1ef..e610e7156 100644 --- a/components/tree/nautilus-tree-model.c +++ b/components/tree/nautilus-tree-model.c @@ -214,7 +214,7 @@ nautilus_tree_model_for_each_postorder (NautilusTreeModel *model, gpointer callback_data) { NautilusTreeNode *current_node; - GList *reporting_queue; + GList *reporting_queue, *link; if (model->details->root_node_reported) { reporting_queue = g_list_prepend (NULL, model->details->root_node); @@ -225,7 +225,10 @@ nautilus_tree_model_for_each_postorder (NautilusTreeModel *model, if (nautilus_tree_node_get_children (current_node) == NULL) { NautilusDirectory *tmp; - reporting_queue = g_list_remove_link (reporting_queue, reporting_queue); + link = reporting_queue; + reporting_queue = g_list_remove_link (reporting_queue, link); + g_list_free_1 (link); + #ifdef DEBUG_TREE printf ("XXX unrefing: %s\n", nautilus_tree_node_get_uri @@ -276,7 +279,7 @@ nautilus_tree_model_monitor_add (NautilusTreeModel *model, gpointer callback_data) { NautilusTreeNode *current_node; - GList *reporting_queue; + GList *reporting_queue, *link; GList *monitor_attributes; reporting_queue = NULL; @@ -314,7 +317,10 @@ nautilus_tree_model_monitor_add (NautilusTreeModel *model, while (reporting_queue != NULL) { current_node = (NautilusTreeNode *) reporting_queue->data; - reporting_queue = g_list_remove_link (reporting_queue, reporting_queue); + + link = reporting_queue; + reporting_queue = g_list_remove_link (reporting_queue, link); + g_list_free_1 (link); (*initial_nodes_callback) (model, current_node, callback_data); diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c index a0a8a86cb..c51ee6fc0 100644 --- a/components/tree/nautilus-tree-view.c +++ b/components/tree/nautilus-tree-view.c @@ -460,6 +460,10 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode * pixmap, mask, pixmap, mask, FALSE, FALSE); + + gdk_pixmap_unref (pixmap); + gdk_bitmap_unref (mask); + nautilus_ctree_node_set_row_data (NAUTILUS_CTREE (view->details->tree), view_node, @@ -485,6 +489,8 @@ nautilus_tree_view_insert_model_node (NautilusTreeView *view, NautilusTreeNode * if (parent_view_node != NULL) { remove_hack_node (view, view_node_to_uri (view, parent_view_node)); } + + g_free (uri); } @@ -572,6 +578,11 @@ nautilus_tree_view_update_model_node (NautilusTreeView *view, NautilusTreeNode * TREE_SPACING, pixmap, mask); + + gdk_pixmap_unref (pixmap); + gdk_bitmap_unref (mask); + + g_free (name); #if 0 /* FIXME bugzilla.eazel.com 2421: @@ -605,9 +616,9 @@ nautilus_tree_view_update_model_node (NautilusTreeView *view, NautilusTreeNode * } } } - } else { - g_free (uri); } + + g_free (uri); } @@ -657,6 +668,8 @@ notify_node_seen (NautilusTreeView *view, (*callback) (view); } + + g_free (uri); } @@ -1375,7 +1388,7 @@ nautilus_tree_view_uri_to_name (const char *uri) char *name; gnome_vfs_uri = gnome_vfs_uri_new (uri); - name = g_strdup (gnome_vfs_uri_extract_short_path_name (gnome_vfs_uri)); + name = gnome_vfs_uri_extract_short_path_name (gnome_vfs_uri); gnome_vfs_uri_unref (gnome_vfs_uri); return name; |