diff --git a/archiver/ChangeLog b/archiver/ChangeLog index bf5354c81..49856564b 100644 --- a/archiver/ChangeLog +++ b/archiver/ChangeLog @@ -1,8 +1,22 @@ +2001-08-23 Bradford Hovinen + + * 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 * 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 diff --git a/archiver/config-log.c b/archiver/config-log.c index 3acc4baad..c2df35c24 100644 --- a/archiver/config-log.c +++ b/archiver/config-log.c @@ -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"); diff --git a/archiver/location.c b/archiver/location.c index 663db4861..45be20088 100644 --- a/archiver/location.c +++ b/archiver/location.c @@ -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;