[gjs] Don't g_error() when failing to release an argument
- From: Owen Taylor <otaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [gjs] Don't g_error() when failing to release an argument
- Date: Fri, 15 May 2009 11:44:28 -0400 (EDT)
commit fc76e9d796c1ed757b49d70513cbe23047b040ed
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu May 14 19:16:02 2009 -0400
Don't g_error() when failing to release an argument
Failing to release an argument can be a symptom of bad introspection
data or other problems that aren't an internal error in gjs. Even if
it is a symptom of an internal error in gjs, propagating the exception
back gives a more meaningful failure than just aborting.
http://bugzilla.gnome.org/show_bug.cgi?id=582686
---
gi/arg.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gi/arg.c b/gi/arg.c
index c85f34e..82f195d 100644
--- a/gi/arg.c
+++ b/gi/arg.c
@@ -1424,6 +1424,7 @@ gjs_value_from_g_argument (JSContext *context,
typedef struct {
JSContext *context;
GITypeInfo *key_param_info, *val_param_info;
+ JSBool failed;
} GHR_closure;
static gboolean
@@ -1434,11 +1435,11 @@ gjs_ghr_helper(gpointer key, gpointer val, gpointer user_data) {
val_arg.v_pointer = val;
if (!gjs_g_argument_release(c->context, GI_TRANSFER_EVERYTHING,
c->key_param_info, &key_arg))
- g_error("Failed to release ghash key");
+ c->failed = JS_TRUE;
if (!gjs_g_argument_release(c->context, GI_TRANSFER_EVERYTHING,
c->val_param_info, &val_arg))
- g_error("Failed to release ghash value");
+ c->failed = JS_TRUE;
return TRUE;
}
@@ -1615,10 +1616,7 @@ gjs_g_arg_release_internal(JSContext *context,
GI_TRANSFER_EVERYTHING,
param_info,
&elem)) {
- /* no way to recover here, and errors should
- * not be possible.
- */
- g_error("Failed to release slist element");
+ failed = JS_TRUE;
}
}
@@ -1633,7 +1631,7 @@ gjs_g_arg_release_internal(JSContext *context,
if (transfer == GI_TRANSFER_CONTAINER)
g_hash_table_steal_all (arg->v_pointer);
else {
- GHR_closure c = { .context = context };
+ GHR_closure c = { .context = context, .failed = JS_FALSE };
c.key_param_info = g_type_info_get_param_type(type_info, 0);
g_assert(c.key_param_info != NULL);
@@ -1643,6 +1641,8 @@ gjs_g_arg_release_internal(JSContext *context,
g_hash_table_foreach_steal (arg->v_pointer,
gjs_ghr_helper, &c);
+ failed = c.failed;
+
g_base_info_unref ((GIBaseInfo *)c.key_param_info);
g_base_info_unref ((GIBaseInfo *)c.val_param_info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]