From 16a7a346ad2f92c58cdbe9a7cd2960686794c80f Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 8 Sep 2008 03:24:31 +0000 Subject: [PATCH] Milan Crha ** Part of fix for bug #328216 (Do not free default certdb itself, rather set it to NULL to not have freed pointer flying around, save certdb only if something has changed). svn path=/trunk/; revision=9491 --- camel/ChangeLog | 8 ++++++++ camel/camel-certdb.c | 6 +++++- camel/camel.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index d48faff..730663c 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2008-09-08 Milan Crha + + ** Part of fix for bug #328216 + + * camel.c: (camel_shutdown): Do not free default certdb itself, + rather set it to NULL to not have freed pointer flying around. + * camel-certdb.c: (camel_certdb_save): Save only when changed. + 2008-09-05 Paul Bolle ** Fix for bug #550412 diff --git a/camel/camel-certdb.c b/camel/camel-certdb.c index ccdb4d1..d6540be 100644 --- a/camel/camel-certdb.c +++ b/camel/camel-certdb.c @@ -336,7 +336,11 @@ camel_certdb_save (CamelCertDB *certdb) g_return_val_if_fail (CAMEL_IS_CERTDB (certdb), -1); g_return_val_if_fail (certdb->filename, -1); - + + /* no change, nothing new to save, simply return success */ + if ((certdb->flags & CAMEL_CERTDB_DIRTY) == 0) + return 0; + filename = alloca (strlen (certdb->filename) + 4); sprintf (filename, "%s~", certdb->filename); diff --git a/camel/camel.c b/camel/camel.c index ea1077c..d19ffcc 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -132,7 +132,7 @@ camel_shutdown (void) certdb = camel_certdb_get_default (); if (certdb) { camel_certdb_save (certdb); - camel_object_unref (certdb); + camel_certdb_set_default (NULL); } /* These next calls must come last. */ -- 2.7.4