summaryrefslogtreecommitdiff
path: root/archiver
diff options
context:
space:
mode:
authorBradford Hovinen <hovinen@ximian.com>2001-08-23 20:09:21 +0000
committerBradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org>2001-08-23 20:09:21 +0000
commit286cb3899a8c1902964c205e16ea77c3315d9e78 (patch)
treea4d66144dc028c8b5f681ad8b51e409a9d1590cb /archiver
parent0ddf82fefe31bc7a1451b94dadab7c9b8cecb965 (diff)
downloadgnome-control-center-286cb3899a8c1902964c205e16ea77c3315d9e78.tar.gz
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
Diffstat (limited to 'archiver')
-rw-r--r--archiver/ChangeLog18
-rw-r--r--archiver/config-log.c9
-rw-r--r--archiver/location.c5
3 files changed, 26 insertions, 6 deletions
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 <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>
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;