Make sure we don't try to do this if we are marked deleted

2001-08-23  Bradford Hovinen  <hovinen@ximian.com>

	* config-log.c (do_unload): Make sure we don't try to do this if
	we are marked deleted
	(config_log_delete): Call do_unload to eliminate memory leaks

	* location.c (location_delete): Set the deleted flag

	* config-log.c (dump_log): Don't try to dump the log if we are
	deleted

	* location.c (save_metadata): Don't try to save metadata if we are
	deleted
This commit is contained in:
Bradford Hovinen 2001-08-23 20:09:21 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 0ddf82fefe
commit 286cb3899a
3 changed files with 26 additions and 6 deletions

View file

@ -1,8 +1,22 @@
2001-08-23 Bradford Hovinen <hovinen@ximian.com>
* config-log.c (do_unload): Make sure we don't try to do this if
we are marked deleted
(config_log_delete): Call do_unload to eliminate memory leaks
* location.c (location_delete): Set the deleted flag
* config-log.c (dump_log): Don't try to dump the log if we are
deleted
* location.c (save_metadata): Don't try to save metadata if we are
deleted
2001-08-22 Hans Petter Jansson <hpj@ximian.com>
* archiver-client.h: Fixed include path, libxml -> gnome-xml. It's
consistent with the includes in archiver-client.c, and it stops the build
breaking here.
consistent with the includes in archiver-client.c, and it stops
the build breaking here.
2001-08-21 Bradford Hovinen <hovinen@ximian.com>

View file

@ -282,12 +282,11 @@ config_log_delete (ConfigLog *config_log)
g_return_if_fail (config_log != NULL);
g_return_if_fail (IS_CONFIG_LOG (config_log));
if (config_log->p->file_stream != NULL)
fclose (config_log->p->file_stream);
if (config_log->p->filename != NULL)
unlink (config_log->p->filename);
do_unload (config_log, FALSE);
config_log->p->deleted = TRUE;
gtk_object_destroy (GTK_OBJECT (config_log));
}
@ -890,6 +889,8 @@ do_unload (ConfigLog *config_log, gboolean write_log)
g_return_if_fail (config_log != NULL);
g_return_if_fail (IS_CONFIG_LOG (config_log));
if (config_log->p->deleted) return;
if (write_log) dump_log (config_log);
if (config_log->p->file_stream) {
@ -976,6 +977,8 @@ dump_log (ConfigLog *config_log)
g_return_if_fail (IS_LOCATION (config_log->p->location));
g_return_if_fail (location_get_path (config_log->p->location) != NULL);
if (config_log->p->deleted) return;
filename_out = g_concat_dir_and_file (location_get_path
(config_log->p->location),
"config.log.out");

View file

@ -72,6 +72,7 @@ struct _LocationPrivate
GList *contains_list; /* List of BackendNotes */
gboolean is_new;
gboolean contains_list_dirty;
gboolean deleted;
ConfigLog *config_log;
};
@ -712,6 +713,8 @@ location_delete (Location *location)
if (rmdir (location->p->fullpath) == -1)
g_warning ("%s: Could not remove directory: %s\n",
__FUNCTION__, g_strerror (errno));
location->p->deleted = TRUE;
}
/**
@ -1592,7 +1595,7 @@ save_metadata (Location *location)
{
gchar *metadata_filename;
if (!location->p->is_new && !location->p->contains_list_dirty)
if (location->p->deleted || (!location->p->is_new && !location->p->contains_list_dirty))
return;
location->p->is_new = FALSE;