summaryrefslogtreecommitdiff
path: root/gerror.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2000-11-05 17:02:37 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-05 17:02:37 +0000
commitd4ff0ef999bb819085a2b060a79e41eecd5fce63 (patch)
treead825bd6a5b29cc5193b0bc21b55b8bcff17bcda /gerror.c
parent110c6cbac8d9cbddc27dcdf3f6c22889262fcc54 (diff)
downloadglib-d4ff0ef999bb819085a2b060a79e41eecd5fce63.tar.gz
Free the src error if the dest location is NULL - I'm pretty sure that's
2000-11-05 Havoc Pennington <hp@pobox.com> * gerror.c (g_propagate_error): Free the src error if the dest location is NULL - I'm pretty sure that's what this function was supposed to do. 2000-11-05 Havoc Pennington <hp@pobox.com> * glib/tmpl/error_reporting.sgml: fixes
Diffstat (limited to 'gerror.c')
-rw-r--r--gerror.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gerror.c b/gerror.c
index 1a032e73e..c365bd2a3 100644
--- a/gerror.c
+++ b/gerror.c
@@ -207,7 +207,7 @@ g_set_error (GError **err,
* @dest: error return location
* @src: error to move into the return location
*
- * Does nothing if @dest is NULL; otherwise,
+ * If @dest is NULL, free @src; otherwise,
* moves @src into *@dest. *@dest must be NULL.
**/
void
@@ -215,14 +215,20 @@ g_propagate_error (GError **dest,
GError *src)
{
g_return_if_fail (src != NULL);
-
- if (dest == NULL)
- return;
- if (*dest != NULL)
- g_warning (ERROR_OVERWRITTEN_WARNING);
-
- *dest = src;
+ if (dest == NULL)
+ {
+ if (src)
+ g_error_free (src);
+ return;
+ }
+ else
+ {
+ if (*dest != NULL)
+ g_warning (ERROR_OVERWRITTEN_WARNING);
+
+ *dest = src;
+ }
}
/**