aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-exception.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-18 06:16:46 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-18 06:16:46 +0800
commit982357f35cdadf9a823dd1b5a3c0a35bf2ecbdad (patch)
tree8a625ee1ff79fcfca14383168d6a67088c0413d5 /camel/camel-exception.c
parent4ddd273ac4fc4dfa9c0b66e740801b16b691c2c1 (diff)
downloadgsoc2013-evolution-982357f35cdadf9a823dd1b5a3c0a35bf2ecbdad.tar.gz
gsoc2013-evolution-982357f35cdadf9a823dd1b5a3c0a35bf2ecbdad.tar.zst
gsoc2013-evolution-982357f35cdadf9a823dd1b5a3c0a35bf2ecbdad.zip
Make sure the new description isn't the same as the old description
2001-10-17 Jeffrey Stedfast <fejj@ximian.com> * camel-exception.c (camel_exception_set): Make sure the new description isn't the same as the old description pointer before freeing the old one. (camel_exception_setv): Don't free the old description until we set the new one this way we can reuse the old description in the new description. * providers/local/camel-mbox-folder.c (mbox_append_message): If errno == EINTR, then we got a user-cancel so set the exception appropriately so that we don't make the user shit his pants. svn path=/trunk/; revision=13737
Diffstat (limited to 'camel/camel-exception.c')
-rw-r--r--camel/camel-exception.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
index 3ae8d74f77..75400fa8df 100644
--- a/camel/camel-exception.c
+++ b/camel/camel-exception.c
@@ -160,9 +160,10 @@ camel_exception_set (CamelException *ex,
ex->id = id;
- if (ex->desc)
- g_free(ex->desc);
- ex->desc = g_strdup(desc);
+ if (desc != ex->desc) {
+ g_free (ex->desc);
+ ex->desc = g_strdup (desc);
+ }
CAMEL_EXCEPTION_UNLOCK(exception);
}
@@ -195,19 +196,21 @@ camel_exception_setv (CamelException *ex,
...)
{
va_list args;
+ char *old;
if (!ex)
return;
CAMEL_EXCEPTION_LOCK(exception);
- if (ex->desc)
- g_free (ex->desc);
+ old = ex->desc;
va_start(args, format);
ex->desc = g_strdup_vprintf (format, args);
va_end (args);
+ g_free (old);
+
ex->id = id;
CAMEL_EXCEPTION_UNLOCK(exception);