Commit cfe2dc48 authored by Darin Adler's avatar Darin Adler

Got leaks in "nautilus --check" down to 0.

	Fixed bug 2488 (path name for link set determined incorrectly) by
	using only paths for link sets, never URIs.

	* tools/leak-checker/nautilus-leak-checker.c: Added more "known to
	leak" symbols.

	* libnautilus-extensions/nautilus-link-set.c: (create_new_link),
	(nautilus_link_set_is_installed), (nautilus_link_set_remove):
	Changed functions to always expect paths, so they can now use
	nautilus_make_path instead of link_set_path_name.
	* src/nautilus-sidebar.c: (metadata_button_callback): Changed to
	turn the URI into a path before calling the link-set functions.

	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_notify_files_moved): Use
	nautilus_file_list_free instead of
	nautilus_g_list_free_deep_custom.
	* libnautilus-extensions/nautilus-string-list.c:
	(nautilus_string_list_clear): Use nautilus_g_list_free_deep
	instead of nautilus_g_list_free_deep_custom.
	* libnautilus-extensions/nautilus-view-identifier.c:
	(nautilus_view_identifier_free_callback),
	(nautilus_view_identifier_list_free): Fixed call to
	nautilus_g_list_free_deep_custom so it doesn't need a function
	pointer type cast any more.
parent ec54fa8b
2000-09-26 Darin Adler <darin@eazel.com>
Got leaks in "nautilus --check" down to 0.
Fixed bug 2488 (path name for link set determined incorrectly) by
using only paths for link sets, never URIs.
* tools/leak-checker/nautilus-leak-checker.c: Added more "known to
leak" symbols.
* libnautilus-extensions/nautilus-link-set.c: (create_new_link),
(nautilus_link_set_is_installed), (nautilus_link_set_remove):
Changed functions to always expect paths, so they can now use
nautilus_make_path instead of link_set_path_name.
* src/nautilus-sidebar.c: (metadata_button_callback): Changed to
turn the URI into a path before calling the link-set functions.
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_notify_files_moved): Use
nautilus_file_list_free instead of
nautilus_g_list_free_deep_custom.
* libnautilus-extensions/nautilus-string-list.c:
(nautilus_string_list_clear): Use nautilus_g_list_free_deep
instead of nautilus_g_list_free_deep_custom.
* libnautilus-extensions/nautilus-view-identifier.c:
(nautilus_view_identifier_free_callback),
(nautilus_view_identifier_list_free): Fixed call to
nautilus_g_list_free_deep_custom so it doesn't need a function
pointer type cast any more.
2000-09-26 Josh Barrow <linuxfan@ionet.net>
* src/nautilus-theme-selector.c: (add_theme_to_icons),
......
......@@ -767,7 +767,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
g_hash_table_destroy (added_lists);
/* Let the file objects go. */
nautilus_g_list_free_deep_custom (unref_list, (GFunc) nautilus_file_unref, NULL);
nautilus_file_list_free (unref_list);
/* Separate handling for brand new file objects. */
nautilus_directory_notify_files_added (new_files_list);
......
......@@ -44,25 +44,6 @@
#include "nautilus-preferences.h"
#include "nautilus-file-utilities.h"
/* utility routine to build the link set path name */
static char *
link_set_path_name (const char *directory_path, const char *name)
{
const char *path_start;
/* FIXME bugzilla.eazel.com 2488:
* This hack is unacceptable. Either it's a URI and the
* file:// must be removed with the function that does that,
* or it's a path, and there's no reason to remove the prefix.
*/
if (nautilus_str_has_prefix(directory_path, "file://"))
path_start = directory_path + 7;
else
path_start = directory_path;
return nautilus_make_path (path_start, name);
}
/* routine to create a new link file in the specified directory */
static gboolean
create_new_link (const char *directory_path, const char *name, const char *image, const char *uri)
......@@ -88,7 +69,7 @@ create_new_link (const char *directory_path, const char *name, const char *image
xmlSetProp (root_node, "LINK", uri);
/* all done, so save the xml document as a link file */
file_name = link_set_path_name (directory_path, name);
file_name = nautilus_make_path (directory_path, name);
result = xmlSaveFile (file_name, output_document);
g_free (file_name);
......@@ -195,7 +176,7 @@ nautilus_link_set_is_installed (const char *directory_path, const char *link_set
node != NULL; node = node->next) {
if (strcmp (node->name, "link") == 0) {
link_name = xmlGetProp (node, "name");
file_name = link_set_path_name (directory_path, link_name);
file_name = nautilus_make_path (directory_path, link_name);
if (!g_file_exists(file_name)) {
g_free(file_name);
return FALSE;
......@@ -230,7 +211,7 @@ nautilus_link_set_remove (const char *directory_path, const char *link_set_name)
if (strcmp (node->name, "link") == 0) {
link_name = xmlGetProp (node, "name");
/* formulate the link file path name */
file_name = link_set_path_name (directory_path, link_name);
file_name = nautilus_make_path (directory_path, link_name);
/* delete the file */
unlink(file_name);
g_free(link_name);
......
......@@ -236,8 +236,7 @@ nautilus_string_list_clear (NautilusStringList *string_list)
{
g_return_if_fail (string_list != NULL);
nautilus_g_list_free_deep_custom (string_list->strings, (GFunc) g_free, NULL);
nautilus_g_list_free_deep (string_list->strings);
string_list->strings = NULL;
}
......
......@@ -147,7 +147,7 @@ nautilus_view_identifier_free (NautilusViewIdentifier *identifier)
}
static void
nautilus_view_identifier_free_callback (NautilusViewIdentifier *identifier, gpointer ignore)
nautilus_view_identifier_free_callback (gpointer identifier, gpointer ignore)
{
g_assert (ignore == NULL);
nautilus_view_identifier_free (identifier);
......@@ -158,7 +158,7 @@ nautilus_view_identifier_list_free (GList *identifiers)
{
nautilus_g_list_free_deep_custom
(identifiers,
(GFunc) nautilus_view_identifier_free_callback,
nautilus_view_identifier_free_callback,
NULL);
}
......
......@@ -767,7 +767,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
g_hash_table_destroy (added_lists);
/* Let the file objects go. */
nautilus_g_list_free_deep_custom (unref_list, (GFunc) nautilus_file_unref, NULL);
nautilus_file_list_free (unref_list);
/* Separate handling for brand new file objects. */
nautilus_directory_notify_files_added (new_files_list);
......
......@@ -44,25 +44,6 @@
#include "nautilus-preferences.h"
#include "nautilus-file-utilities.h"
/* utility routine to build the link set path name */
static char *
link_set_path_name (const char *directory_path, const char *name)
{
const char *path_start;
/* FIXME bugzilla.eazel.com 2488:
* This hack is unacceptable. Either it's a URI and the
* file:// must be removed with the function that does that,
* or it's a path, and there's no reason to remove the prefix.
*/
if (nautilus_str_has_prefix(directory_path, "file://"))
path_start = directory_path + 7;
else
path_start = directory_path;
return nautilus_make_path (path_start, name);
}
/* routine to create a new link file in the specified directory */
static gboolean
create_new_link (const char *directory_path, const char *name, const char *image, const char *uri)
......@@ -88,7 +69,7 @@ create_new_link (const char *directory_path, const char *name, const char *image
xmlSetProp (root_node, "LINK", uri);
/* all done, so save the xml document as a link file */
file_name = link_set_path_name (directory_path, name);
file_name = nautilus_make_path (directory_path, name);
result = xmlSaveFile (file_name, output_document);
g_free (file_name);
......@@ -195,7 +176,7 @@ nautilus_link_set_is_installed (const char *directory_path, const char *link_set
node != NULL; node = node->next) {
if (strcmp (node->name, "link") == 0) {
link_name = xmlGetProp (node, "name");
file_name = link_set_path_name (directory_path, link_name);
file_name = nautilus_make_path (directory_path, link_name);
if (!g_file_exists(file_name)) {
g_free(file_name);
return FALSE;
......@@ -230,7 +211,7 @@ nautilus_link_set_remove (const char *directory_path, const char *link_set_name)
if (strcmp (node->name, "link") == 0) {
link_name = xmlGetProp (node, "name");
/* formulate the link file path name */
file_name = link_set_path_name (directory_path, link_name);
file_name = nautilus_make_path (directory_path, link_name);
/* delete the file */
unlink(file_name);
g_free(link_name);
......
......@@ -236,8 +236,7 @@ nautilus_string_list_clear (NautilusStringList *string_list)
{
g_return_if_fail (string_list != NULL);
nautilus_g_list_free_deep_custom (string_list->strings, (GFunc) g_free, NULL);
nautilus_g_list_free_deep (string_list->strings);
string_list->strings = NULL;
}
......
......@@ -147,7 +147,7 @@ nautilus_view_identifier_free (NautilusViewIdentifier *identifier)
}
static void
nautilus_view_identifier_free_callback (NautilusViewIdentifier *identifier, gpointer ignore)
nautilus_view_identifier_free_callback (gpointer identifier, gpointer ignore)
{
g_assert (ignore == NULL);
nautilus_view_identifier_free (identifier);
......@@ -158,7 +158,7 @@ nautilus_view_identifier_list_free (GList *identifiers)
{
nautilus_g_list_free_deep_custom
(identifiers,
(GFunc) nautilus_view_identifier_free_callback,
nautilus_view_identifier_free_callback,
NULL);
}
......
......@@ -1120,15 +1120,20 @@ command_button_callback (GtkWidget *button, char *id_str)
a shell to handle general ones */
/* for now, we only handle a few built in commands */
static void
metadata_button_callback (GtkWidget *button, char *command_str)
metadata_button_callback (GtkWidget *button, const char *command_str)
{
GtkWindow *window;
NautilusSidebar *sidebar;
char *path;
sidebar = NAUTILUS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (button)));
if (!strcmp(command_str, "#linksets")) {
if (strcmp (command_str, "#linksets") == 0) {
window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)));
nautilus_link_set_toggle_configure_window(sidebar->details->uri, window);
path = gnome_vfs_get_local_path_from_uri (sidebar->details->uri);
if (path != NULL) {
nautilus_link_set_toggle_configure_window (path, window);
g_free (path);
}
}
}
......@@ -1226,7 +1231,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
/* utility to construct command buttons for the sidebar from the passed in metadata string */
static void
add_buttons_from_metadata(NautilusSidebar *sidebar, const char *button_data)
add_buttons_from_metadata (NautilusSidebar *sidebar, const char *button_data)
{
char **terms;
char *current_term, *temp_str;
......@@ -1251,25 +1256,24 @@ add_buttons_from_metadata(NautilusSidebar *sidebar, const char *button_data)
if (button_name != NULL) {
temp_button = gtk_button_new_with_label (button_name);
gtk_box_pack_start (GTK_BOX (sidebar->details->button_box),
temp_button,
FALSE, FALSE,
0);
temp_button,
FALSE, FALSE,
0);
sidebar->details->has_buttons = TRUE;
command_string = g_strdup(temp_str + 1);
g_free(button_name);
command_string = g_strdup (temp_str + 1);
g_free (button_name);
nautilus_gtk_signal_connect_free_data
(GTK_OBJECT (temp_button), "clicked",
GTK_SIGNAL_FUNC (metadata_button_callback), command_string);
GTK_SIGNAL_FUNC (metadata_button_callback), command_string);
gtk_object_set_user_data (GTK_OBJECT (temp_button), sidebar);
gtk_widget_show (temp_button);
}
}
}
g_free(current_term);
}
}
g_strfreev (terms);
}
......
......@@ -1120,15 +1120,20 @@ command_button_callback (GtkWidget *button, char *id_str)
a shell to handle general ones */
/* for now, we only handle a few built in commands */
static void
metadata_button_callback (GtkWidget *button, char *command_str)
metadata_button_callback (GtkWidget *button, const char *command_str)
{
GtkWindow *window;
NautilusSidebar *sidebar;
char *path;
sidebar = NAUTILUS_SIDEBAR (gtk_object_get_user_data (GTK_OBJECT (button)));
if (!strcmp(command_str, "#linksets")) {
if (strcmp (command_str, "#linksets") == 0) {
window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)));
nautilus_link_set_toggle_configure_window(sidebar->details->uri, window);
path = gnome_vfs_get_local_path_from_uri (sidebar->details->uri);
if (path != NULL) {
nautilus_link_set_toggle_configure_window (path, window);
g_free (path);
}
}
}
......@@ -1226,7 +1231,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
/* utility to construct command buttons for the sidebar from the passed in metadata string */
static void
add_buttons_from_metadata(NautilusSidebar *sidebar, const char *button_data)
add_buttons_from_metadata (NautilusSidebar *sidebar, const char *button_data)
{
char **terms;
char *current_term, *temp_str;
......@@ -1251,25 +1256,24 @@ add_buttons_from_metadata(NautilusSidebar *sidebar, const char *button_data)
if (button_name != NULL) {
temp_button = gtk_button_new_with_label (button_name);
gtk_box_pack_start (GTK_BOX (sidebar->details->button_box),
temp_button,
FALSE, FALSE,
0);
temp_button,
FALSE, FALSE,
0);
sidebar->details->has_buttons = TRUE;
command_string = g_strdup(temp_str + 1);
g_free(button_name);
command_string = g_strdup (temp_str + 1);
g_free (button_name);
nautilus_gtk_signal_connect_free_data
(GTK_OBJECT (temp_button), "clicked",
GTK_SIGNAL_FUNC (metadata_button_callback), command_string);
GTK_SIGNAL_FUNC (metadata_button_callback), command_string);
gtk_object_set_user_data (GTK_OBJECT (temp_button), sidebar);
gtk_widget_show (temp_button);
}
}
}
g_free(current_term);
}
}
g_strfreev (terms);
}
......
......@@ -62,6 +62,7 @@ int (* real_start_main) (int (*main) (int, char **, char **), int argc,
* For ones that don't, list tell-tale stack crawl function names.
*/
static const char * const known_leakers[] = {
"ConfigServer_remove_listener", /* gconf */
"XSupportsLocale",
"__bindtextdomain",
"__pthread_initialize_manager",
......@@ -77,6 +78,7 @@ static const char * const known_leakers[] = {
"g_get_any_init",
"g_hash_node_new",
"g_log_set_handler",
"g_main_add_poll_unlocked", /* no easy way to make it not cache blocks */
"g_quark_new",
"g_thread_init",
"gconf_postinit",
......@@ -105,6 +107,7 @@ static const char * const known_leakers[] = {
"register_client", /* gconf */
"setlocale",
"stock_pixmaps", /* gnome-libs */
"try_to_contact_server", /* gconf */
"tzset_internal",
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment