GNOME Bugzilla – Bug 693217
The GStrv-to-js conversion crashes
Last modified: 2013-02-06 07:32:16 UTC
libseed crashes when converting a GStrv to a javascript value. It happens when the javascript code connects to the "g-properties-changed" GLib signal on GDBusProxy objects. The attached patch fixes the crash.
Created attachment 235238 [details] [review] [PATCH] seed-types.c: fix binding GStrv to javascript value
Review of attachment 235238 [details] [review]: ::: libseed/seed-types.c @@ +2600,3 @@ { + JSValueRef js_value = seed_value_from_string (ctx, *val, exception); + js_string_array = g_array_append_val(js_string_array, js_value); I am not a Seed developer, but this seems correct to me. It changes js_string_array from effectively being a JSStringRef[] (i.e. struct String **) to effectively being a JSValueRef[] (i.e. struct Value **) as expected by JSObjectMakeArray. It's also consistent with seed_gi_make_jsarray() now. I do wonder whether the intermediate JSValueRefs need to be freed, or whether JSObjectMakeArray has "take ownership" semantics; but if seed_gi_make_jsarray() is correct and non-leaky, then this function is correct too. Whitespace nitpicking: "val (".
Thanks good catch.