diff options
author | Darin Adler <darin@src.gnome.org> | 2000-09-27 00:07:33 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-09-27 00:07:33 +0000 |
commit | e8af12ac65b5f5b4f2a5f055166a5f7d8580e525 (patch) | |
tree | 6d65095b33955cc35cf65d535aefeda1fbbefe46 /src/nautilus-sidebar-tabs.c | |
parent | d6f51369b565f566af792f02ae21336cd38d18cb (diff) | |
download | nautilus-e8af12ac65b5f5b4f2a5f055166a5f7d8580e525.tar.gz |
Fix more storage leaks.
* components/tree/nautilus-tree-node.c: (nautilus_tree_node_new):
Get rid of extra allocation of node->details that caused a storage
leak.
* components/tree/nautilus-tree-view.c:
(nautilus_tree_view_insert_model_node): Add a g_free.
(free_uri_to_node_map_entry), (free_uri_to_hack_node_map_entry),
(nautilus_tree_view_destroy): Free the keys of the hash table.
(tree_expand_callback), (tree_collapse_callback),
(tree_select_row_callback): Added missing g_free.
(nautilus_tree_view_item_at): Removed an excess g_strdup.
* libnautilus-extensions/nautilus-preference.c:
(preference_initialize_if_needed): Destroy the global preference
table on exit.
(preference_hash_node_free_func): Free the hash key as well as
the node value.
(preference_register): Use strdup on keys as then are entered
into the hash table.
(preference_hash_node_lookup_with_registration): Remove the strdup
in here since preference_register now handles it.
(destroy_global_preference_table): Renamed and simplified the
existing unused function.
* libnautilus-extensions/nautilus-volume-monitor.c:
(nautilus_volume_monitor_destroy), (free_volume): Free the volume
itself, not just the fields within it.
* src/nautilus-complex-search-bar.c:
(nautilus_complex_search_bar_get_location): Added a missing
g_free.
* src/nautilus-sidebar-tabs.c: (tab_item_destroy_cover),
(nautilus_sidebar_tabs_destroy): Free the tab items too, not just
the list they are stored in.
* src/nautilus-switchable-search-bar.c:
(search_bar_preference_changed_callback): Added a missing g_free.
* libnautilus-extensions/nautilus-theme.c: (free_default_theme),
(nautilus_theme_get_theme_data): Add code to free the default
theme on program exit to make leak detection easier.
* src/nautilus-main.c: (main): Clean up the memory used by the XML
parser on exit to make leak detection easier.
* libnautilus/Makefile.am:
* libnautilus/nautilus-bonobo-workarounds.c:
* libnautilus/nautilus-bonobo-workarounds.h:
Added version of bonobo_object_get_epv that shares a single global
instance instead of allocating a new one each time it's called.
* components/adapter/nautilus-adapter-factory-server.c:
(impl_Nautilus_ComponentAdapterFactory__create):
* libnautilus-extensions/bonobo-stream-vfs.c:
(bonobo_stream_vfs_class_init):
* libnautilus-extensions/nautilus-undo-context.c:
(impl_Nautilus_Undo_Context__create):
* libnautilus-extensions/nautilus-undo-manager.c:
(nautilus_undo_manager_initialize_class):
* libnautilus/nautilus-undo-transaction.c:
(impl_Nautilus_Undo_Transaction__create):
* libnautilus/nautilus-view.c: (impl_Nautilus_View__create):
* src/nautilus-history-frame.c:
(impl_Nautilus_HistoryFrame__create):
* src/nautilus-shell.c: (nautilus_shell_get_vepv):
* src/nautilus-view-frame-corba.c:
(impl_Nautilus_ViewFrame__create):
* src/nautilus-zoomable-frame-corba.c:
(impl_Nautilus_ZoomableFrame__create):
Use the new cover for bonobo_object_get_epv to avoid
making lots of copies of it.
* src/nautilus-window-menus.c: (get_user_level_image): Formatting
tweak.
* tools/leak-checker/nautilus-leak-checker.c: Added more "known to
allocate and not free on exit" functions.
Diffstat (limited to 'src/nautilus-sidebar-tabs.c')
-rw-r--r-- | src/nautilus-sidebar-tabs.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c index 78a242720..5f5a270f5 100644 --- a/src/nautilus-sidebar-tabs.c +++ b/src/nautilus-sidebar-tabs.c @@ -25,23 +25,21 @@ #include <config.h> #include "nautilus-sidebar-tabs.h" -#include <math.h> -#include <stdio.h> -#include <string.h> +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <libgnome/gnome-defs.h> +#include <libgnome/gnome-util.h> #include <libnautilus-extensions/nautilus-gdk-extensions.h> -#include <libnautilus-extensions/nautilus-global-preferences.h> #include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h> +#include <libnautilus-extensions/nautilus-glib-extensions.h> +#include <libnautilus-extensions/nautilus-global-preferences.h> #include <libnautilus-extensions/nautilus-gnome-extensions.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> #include <libnautilus-extensions/nautilus-scalable-font.h> #include <libnautilus-extensions/nautilus-theme.h> - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <libart_lgpl/art_rect.h> -#include <libart_lgpl/art_rgb.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> +#include <math.h> +#include <stdio.h> +#include <string.h> /* constants for the tab piece pixbuf array */ @@ -278,6 +276,13 @@ tab_item_destroy (TabItem *item) } static void +tab_item_destroy_cover (gpointer item, gpointer callback_data) +{ + g_assert (callback_data == NULL); + tab_item_destroy (item); +} + +static void nautilus_sidebar_tabs_destroy (GtkObject *object) { NautilusSidebarTabs *sidebar_tabs = NAUTILUS_SIDEBAR_TABS(object); @@ -285,19 +290,20 @@ nautilus_sidebar_tabs_destroy (GtkObject *object) /* deallocate the tab piece images, if any */ if (sidebar_tabs->details->tab_piece_images[0] != NULL) { nautilus_sidebar_tabs_unload_tab_pieces (sidebar_tabs); - } + } - if (sidebar_tabs->details->tab_font) { + if (sidebar_tabs->details->tab_font != NULL) { gtk_object_unref (GTK_OBJECT (sidebar_tabs->details->tab_font)); } /* release the tab list, if any */ - if (sidebar_tabs->details->tab_items) - g_list_free (sidebar_tabs->details->tab_items); - - nautilus_preferences_remove_callback(NAUTILUS_PREFERENCES_THEME, - (NautilusPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, - sidebar_tabs); + nautilus_g_list_free_deep_custom (sidebar_tabs->details->tab_items, + tab_item_destroy_cover, + NULL); + + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, + (NautilusPreferencesCallback) nautilus_sidebar_tabs_load_theme_data, + sidebar_tabs); g_free (sidebar_tabs->details); @@ -1186,7 +1192,7 @@ nautilus_sidebar_tabs_add_view (NautilusSidebarTabs *sidebar_tabs, const char *n new_tab_item->notebook_page = page_num; /* add it to the list */ - sidebar_tabs->details->tab_items = g_list_append(sidebar_tabs->details->tab_items, new_tab_item); + sidebar_tabs->details->tab_items = g_list_append (sidebar_tabs->details->tab_items, new_tab_item); sidebar_tabs->details->tab_count += 1; recalculate_size (sidebar_tabs); |