Hello community, here is the log from the commit of package cjs for openSUSE:Factory checked in at 2017-11-14 12:55:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cjs (Old) and /work/SRC/openSUSE:Factory/.cjs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cjs" Tue Nov 14 12:55:35 2017 rev:9 rq:540368 version:3.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/cjs/cjs.changes 2017-08-22 11:10:49.330291437 +0200 +++ /work/SRC/openSUSE:Factory/.cjs.new/cjs.changes 2017-11-14 12:55:36.778479576 +0100 @@ -1,0 +2,20 @@ +Thu Nov 9 18:24:42 UTC 2017 - [email protected] + +- Update to version 3.6.1: + * cairo: Free popped pattern. + * value: Fix a memory leak while marshalling GValue. + * arg: Fix memory leaks. + +------------------------------------------------------------------- +Sat Oct 28 19:57:36 UTC 2017 - [email protected] + +- Update to version 3.6.0: + * object: Keep proper track of pending closure invalidations. + * Revert "handler ID's must be managed from start to finish - + they should be initialised to 0, and re-set to 0 whenever + they're finished being used". + * object: Zero out new ConnectData. + * Revert freeing closures in idle handler. + * closure: Prevent collection of invalidated closure + +------------------------------------------------------------------- Old: ---- cjs-3.4.4.tar.gz New: ---- cjs-3.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cjs.spec ++++++ --- /var/tmp/diff_new_pack.pPSEgF/_old 2017-11-14 12:55:37.430455728 +0100 +++ /var/tmp/diff_new_pack.pPSEgF/_new 2017-11-14 12:55:37.430455728 +0100 @@ -20,7 +20,7 @@ %define sover 0 %define typelib typelib-1_0-CjsPrivate-1_0 Name: cjs -Version: 3.4.4 +Version: 3.6.1 Release: 0 Summary: JavaScript module used by Cinnamon License: MIT AND (MPL-1.1 OR GPL-2.0+ OR LGPL-2.1+) ++++++ cjs-3.4.4.tar.gz -> cjs-3.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/README new/cjs-3.6.1/README --- old/cjs-3.4.4/README 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/README 2017-11-09 14:32:12.000000000 +0100 @@ -1,9 +1,29 @@ -JavaScript bindings for GNOME -============================= +JavaScript bindings for Cinnamon +================================ -Available as part of your GNOME distribution. Powers GNOME Shell, Polari, -GNOME Documents, and many other apps. +Based on GJS: https://wiki.gnome.org/action/show/Projects/Gjs -Wiki: https://wiki.gnome.org/action/show/Projects/Gjs +Please do the following when reporting CJS crashes: +=================================================== -How to build and run if you want to contribute to GJS: see doc/Hacking.md +If possible, provide a stack trace. + +Run dmesg and provide the line related to the crash, for instance: + +[ 4947.459104] cinnamon[2868]: segfault at 7f2611ffffe8 ip 00007f2667dda305 sp 00007fffb416b9d0 error 4 in libcjs.so.0.0.0[7f2667db1000+c1000] + +Launch the Calculator, choose Advanced Mode and set it to Hexadecimal. Then substract the loading address (first address in brackets: 7f2667db1000) from the ip (00007f2667dda305). + +In the example above: + +ip: 00007f2667dda305 +loading address: 7f2667db1000 + +00007f2667dda305 - 7f2667db1000 = 29305 + +This gives us the offset. Use addr2line to see what's under it in our shared library: + +addr2line -e /usr/lib/libcjs.so.0.0.0 29305 -fCi +gjs_typecheck_boxed + +When reporting the bug, along with the trace and the dmesg line, please report that function name (in this example gjs_typecheck_boxed). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/README.md new/cjs-3.6.1/README.md --- old/cjs-3.4.4/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/cjs-3.6.1/README.md 2017-11-09 14:32:12.000000000 +0100 @@ -0,0 +1,31 @@ +JavaScript bindings for Cinnamon +================================ + +Based on GJS: https://wiki.gnome.org/action/show/Projects/Gjs + +Please do the following when reporting CJS crashes: +=================================================== + +If possible, provide a stack trace. + +Run dmesg and provide the line related to the crash, for instance: + +`[ 4947.459104] cinnamon[2868]: segfault at 7f2611ffffe8 ip **00007f2667dda305** sp 00007fffb416b9d0 error 4 in libcjs.so.0.0.0[**7f2667db1000**+c1000]` + +Launch the Calculator, choose Advanced Mode and set it to Hexadecimal. Then substract the loading address (first address in brackets: 7f2667db1000) from the ip (00007f2667dda305). + +In the example above: + +ip: 00007f2667dda305 +loading address: 7f2667db1000 + +`00007f2667dda305 - 7f2667db1000 = 29305` + +This gives us the offset. Use addr2line to see what's under it in our shared library: + +``` +addr2line -e /usr/lib/libcjs.so.0.0.0 29305 -fCi +gjs_typecheck_boxed +``` + +When reporting the bug, along with the trace and the dmesg line, please report that function name (in this example gjs_typecheck_boxed). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/configure.ac new/cjs-3.6.1/configure.ac --- old/cjs-3.4.4/configure.ac 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/configure.ac 2017-11-09 14:32:12.000000000 +0100 @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. m4_define(pkg_major_version, 3) -m4_define(pkg_minor_version, 4) -m4_define(pkg_micro_version, 4) +m4_define(pkg_minor_version, 6) +m4_define(pkg_micro_version, 1) m4_define(pkg_version, pkg_major_version.pkg_minor_version.pkg_micro_version) m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 + pkg_micro_version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/debian/changelog new/cjs-3.6.1/debian/changelog --- old/cjs-3.4.4/debian/changelog 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/debian/changelog 2017-11-09 14:32:12.000000000 +0100 @@ -1,4 +1,13 @@ -cjs (3.4.4) sonya; urgency=medium +cjs (3.6.1) sylvia; urgency=medium + + [ Simon Brown ] + * cairo: Free popped pattern (#59) + * value: Fix memory leak while marshalling GValue (#57) + * arg: Fix memory leaks (#58) + + -- Clement Lefebvre <[email protected]> Thu, 09 Nov 2017 13:31:37 +0000 + +cjs (3.6.0) sylvia; urgency=medium [ leigh123linux ] * object: Keep proper track of pending closure invalidations @@ -10,7 +19,15 @@ [ Jason Hicks ] * object: Zero out new ConnectData - -- Clement Lefebvre <[email protected]> Wed, 09 Aug 2017 12:43:19 +0200 + [ Clement Lefebvre ] + * Update README + * Add a README.md + + [ Philip Chimento ] + * Revert freeing closures in idle handler + * closure: Prevent collection of invalidated closure + + -- Clement Lefebvre <[email protected]> Sat, 21 Oct 2017 13:49:00 +0100 cjs (3.4.3) sonya; urgency=medium diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/gi/arg.cpp new/cjs-3.6.1/gi/arg.cpp --- old/cjs-3.4.4/gi/arg.cpp 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/gi/arg.cpp 2017-11-09 14:32:12.000000000 +0100 @@ -1884,9 +1884,6 @@ gpointer data; gsize length; GIArrayType array_type = g_type_info_get_array_type(type_info); - GITypeInfo *param_info; - - param_info = g_type_info_get_param_type(type_info, 0); /* First, let's handle the case where we're passed an instance * of our own byteArray class. @@ -1915,6 +1912,7 @@ break; } + GITypeInfo *param_info = g_type_info_get_param_type(type_info, 0); if (array_type == GI_ARRAY_TYPE_C) { arg->v_pointer = data; } else if (array_type == GI_ARRAY_TYPE_ARRAY) { @@ -2268,33 +2266,32 @@ ITERATE(double); break; case GI_TYPE_TAG_INTERFACE: { - GIBaseInfo *interface_info; - GIInfoType info_type; - - interface_info = g_type_info_get_interface (param_info); - info_type = g_base_info_get_type (interface_info); + GIBaseInfo *interface_info = g_type_info_get_interface (param_info); + GIInfoType info_type = g_base_info_get_type (interface_info); - if ((info_type == GI_INFO_TYPE_STRUCT || - info_type == GI_INFO_TYPE_UNION) && - !g_type_info_is_pointer (param_info)) { - gsize struct_size; - - if (info_type == GI_INFO_TYPE_UNION) - struct_size = g_union_info_get_size ((GIUnionInfo*)interface_info); - else - struct_size = g_struct_info_get_size ((GIStructInfo*)interface_info); - - for (i = 0; i < length; i++) { - arg.v_pointer = ((char*)array) + (struct_size * i); - - if (!gjs_value_from_g_argument(context, elems[i], param_info, - &arg, true)) - return false; - } + if ((info_type == GI_INFO_TYPE_STRUCT || + info_type == GI_INFO_TYPE_UNION) && + !g_type_info_is_pointer (param_info)) { + size_t struct_size; + + if (info_type == GI_INFO_TYPE_UNION) + struct_size = g_union_info_get_size (interface_info); + else + struct_size = g_struct_info_get_size (interface_info); + + for (i = 0; i < length; i++) { + arg.v_pointer = static_cast<char *>(array) + (struct_size * i); + + if (!gjs_value_from_g_argument(context, elems[i], param_info, + &arg, true)) + return false; + } - break; - } + g_base_info_unref(interface_info); + break; + } + g_base_info_unref(interface_info); } /* fallthrough */ case GI_TYPE_TAG_GTYPE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/gi/closure.cpp new/cjs-3.6.1/gi/closure.cpp --- old/cjs-3.4.4/gi/closure.cpp 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/gi/closure.cpp 2017-11-09 14:32:12.000000000 +0100 @@ -35,7 +35,6 @@ struct Closure { JSContext *context; GjsMaybeOwned<JSObject *> obj; - unsigned idle_clear_id; }; struct GjsClosure { @@ -117,25 +116,6 @@ } } -/* Closures have to drop their references to their JS functions in an idle - * handler, because otherwise the closure might stop tracing the function object - * in the middle of garbage collection. That is not allowed with incremental GC. - */ -static gboolean -closure_clear_idle(void *data) -{ - auto closure = static_cast<GjsClosure *>(data); - gjs_debug_closure("Clearing closure %p which calls object %p", - &closure->priv, closure->priv.obj.get()); - - closure->priv.obj.reset(); - closure->priv.context = nullptr; - closure->priv.idle_clear_id = 0; - - g_closure_unref(static_cast<GClosure *>(data)); - return G_SOURCE_REMOVE; -} - /* Invalidation is like "dispose" - it is guaranteed to happen at * finalize, but may happen before finalize. Normally, g_closure_invalidate() * is called when the "target" of the closure becomes invalid, so that the @@ -176,18 +156,21 @@ "removing our destroy notifier on global object)", closure); - c->idle_clear_id = g_idle_add(closure_clear_idle, closure); - g_closure_ref(closure); + c->obj.reset(); + c->context = nullptr; } static void closure_set_invalid(gpointer data, GClosure *closure) { + Closure *self = &((GjsClosure*) closure)->priv; + + JS::ExposeObjectToActiveJS(self->obj); + self->obj.reset(); + self->context = nullptr; + GJS_DEC_COUNTER(closure); - Closure *c = &(reinterpret_cast<GjsClosure *>(closure))->priv; - c->idle_clear_id = g_idle_add(closure_clear_idle, closure); - g_closure_ref(closure); } static void @@ -196,13 +179,6 @@ { Closure *self = &((GjsClosure*) closure)->priv; - if (self->idle_clear_id > 0) { - /* Remove any pending closure_clear_idle(), we are doing it - * immediately here. */ - g_source_remove(self->idle_clear_id); - closure_clear_idle(closure); - } - self->~Closure(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/gi/object.cpp new/cjs-3.6.1/gi/object.cpp --- old/cjs-3.4.4/gi/object.cpp 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/gi/object.cpp 2017-11-09 14:32:12.000000000 +0100 @@ -24,7 +24,6 @@ #include <config.h> #include <deque> -#include <map> #include <memory> #include <set> #include <stack> @@ -66,7 +65,6 @@ /* a list of all signal connections, used when tracing */ std::set<ConnectData *> signals; - std::map<ConnectData *, unsigned> pending_invalidations; /* the GObjectClass wrapped by this JS Object (only used for prototypes) */ @@ -1408,61 +1406,14 @@ vfunc->js_function.trace(tracer, "ObjectInstance::vfunc"); } -/* Removing the signal connection data from the list means that the object stops - * tracing the JS function objects belonging to the closures. Incremental GC - * does not allow that in the middle of a garbage collection. Therefore, we must - * do it in an idle handler. - */ -static gboolean -signal_connection_invalidate_idle(void *user_data) -{ - auto cd = static_cast<ConnectData *>(user_data); - cd->obj->pending_invalidations.erase(cd); - cd->obj->signals.erase(cd); - g_slice_free(ConnectData, cd); - return G_SOURCE_REMOVE; -} - static void signal_connection_invalidated(void *data, GClosure *closure) { auto cd = static_cast<ConnectData *>(data); - std::map<ConnectData *, unsigned>& pending = cd->obj->pending_invalidations; - g_assert(pending.count(cd) == 0); - pending[cd] = g_idle_add(signal_connection_invalidate_idle, cd); -} - -/* This is basically the same as invalidate_all_signals(), but does not defer - * the invalidation to an idle handler. */ -static void -invalidate_all_signals_now(ObjectInstance *priv) -{ - for (auto& iter : priv->pending_invalidations) { - ConnectData *cd = iter.first; - g_source_remove(iter.second); - g_slice_free(ConnectData, cd); - /* Erase element if not already erased */ - priv->signals.erase(cd); - } - priv->pending_invalidations.clear(); - /* Can't loop directly through the items, since invalidating an item's - * closure might have the effect of removing the item from the set in the - * invalidate notifier. */ - while (!priv->signals.empty()) { - ConnectData *cd = *priv->signals.begin(); - - /* We have to remove the invalidate notifier, which would - * otherwise schedule a new pending invalidation. */ - g_closure_remove_invalidate_notifier(cd->closure, cd, - signal_connection_invalidated); - g_closure_invalidate(cd->closure); - - g_slice_free(ConnectData, cd); - /* Erase element if not already erased */ - priv->signals.erase(cd); - } + cd->obj->signals.erase(cd); + g_slice_free(ConnectData, cd); } static void @@ -1484,16 +1435,9 @@ priv->info ? g_base_info_get_namespace((GIBaseInfo*) priv->info) : "_gjs_private", priv->info ? g_base_info_get_name((GIBaseInfo*) priv->info) : g_type_name(priv->gtype))); - /* We must invalidate all signal connections now, instead of in an idle - * handler, because the object will not exist anymore when we get around to - * the idle function. We originally needed to defer these invalidations to - * an idle function since the object needs to continue tracing its signal - * connections while GC is going on. However, once the object is finalized, - * it will not be tracing them any longer anyway, so it's safe to do them - * now. - * This applies only to instances, not prototypes, but it's possible that + /* This applies only to instances, not prototypes, but it's possible that * an instance's GObject is already freed at this point. */ - invalidate_all_signals_now(priv); + invalidate_all_signals(priv); /* Object is instance, not prototype, AND GObject is not already freed */ if (priv->gobj) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/gi/value.cpp new/cjs-3.6.1/gi/value.cpp --- old/cjs-3.4.4/gi/value.cpp 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/gi/value.cpp 2017-11-09 14:32:12.000000000 +0100 @@ -532,6 +532,7 @@ return false; g_value_set_boxed(gvalue, &nested_gvalue); + g_value_unset(&nested_gvalue); return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cjs-3.4.4/modules/cairo-context.cpp new/cjs-3.6.1/modules/cairo-context.cpp --- old/cjs-3.4.4/modules/cairo-context.cpp 2017-08-09 12:43:55.000000000 +0200 +++ new/cjs-3.6.1/modules/cairo-context.cpp 2017-11-09 14:32:12.000000000 +0100 @@ -717,8 +717,9 @@ if (!gjs_cairo_check_status(context, cairo_status(cr), "context")) return false; - /* pattern belongs to the context, so keep the reference */ pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern); + cairo_pattern_destroy(pattern); + if (!pattern_wrapper) { gjs_throw(context, "failed to create pattern"); return false;
