diff -Nru gjs-1.64.3/debian/changelog gjs-1.64.5/debian/changelog --- gjs-1.64.3/debian/changelog 2020-06-03 14:21:53.000000000 +0000 +++ gjs-1.64.5/debian/changelog 2021-02-22 13:56:22.000000000 +0000 @@ -1,3 +1,13 @@ +gjs (1.64.5-0ubuntu0.20.04.01) focal; urgency=medium + + * New upstream release (LP: #1916488): + - Fix Error in function "_init()" in module "modules/overrides/GObject.js" + - gi/wrapperutils: Move gjs_get_string_id() into resolve() implementations + - overrides/Gtk: Set BuilderScope in class init + - fix readline build on certain systems + + -- Marco Trevisan (Treviño) Mon, 22 Feb 2021 14:56:22 +0100 + gjs (1.64.3-1~ubuntu20.04.1) focal; urgency=medium * Merge with debian, as per new upstream stable release (LP: #1881912) @@ -221,8 +231,8 @@ * New upstream release * d/control: update build-dep on gobject-introspection to 1.61.2 - * d/rules: --with-xvfb-tests option has been removed - * d/test.sh: call xvfb-run from the test wrapper to start a server + * d/rules: --with-xvfb-tests option has been removed + * d/test.sh: call xvfb-run from the test wrapper to start a server * d/control: build-dep on xauth for xvfb-run -- Tim Lunn Wed, 11 Sep 2019 22:02:08 +1000 @@ -230,7 +240,7 @@ gjs (1.57.91-2) experimental; urgency=medium * fix up depends so autopkgtests pass again - - debian/control: + - debian/control: - depend on libcairo2-dev, this was implicitly pulled by libgtk3 before - runtime depend on gir1.2-gtk-3.0 @@ -381,7 +391,7 @@ gjs (1.52.3-1) unstable; urgency=medium - * New upstream release + * New upstream release -- Tim Lunn Tue, 08 May 2018 17:18:07 +1000 @@ -393,7 +403,7 @@ gjs (1.52.1-1) unstable; urgency=medium - * New upstream release + * New upstream release * Drop patch included in new release -- Tim Lunn Thu, 12 Apr 2018 18:12:07 +1000 diff -Nru gjs-1.64.3/debian/watch gjs-1.64.5/debian/watch --- gjs-1.64.3/debian/watch 2020-06-03 14:21:53.000000000 +0000 +++ gjs-1.64.5/debian/watch 2021-02-22 13:56:22.000000000 +0000 @@ -1,3 +1,3 @@ version=4 -https://download.gnome.org/sources/@PACKAGE@/([\d\.]+[02468])/ \ +https://download.gnome.org/sources/@PACKAGE@/(1\.64)/ \ @PACKAGE@@ANY_VERSION@\.tar\.xz diff -Nru gjs-1.64.3/gi/boxed.cpp gjs-1.64.5/gi/boxed.cpp --- gjs-1.64.3/gi/boxed.cpp 2020-05-31 17:42:30.596444100 +0000 +++ gjs-1.64.5/gi/boxed.cpp 2021-01-09 22:53:50.229958500 +0000 @@ -67,11 +67,18 @@ // See GIWrapperBase::resolve(). bool BoxedPrototype::resolve_impl(JSContext* cx, JS::HandleObject obj, - JS::HandleId, const char* prop_name, - bool* resolved) { + JS::HandleId id, bool* resolved) { + JS::UniqueChars prop_name; + if (!gjs_get_string_id(cx, id, &prop_name)) + return false; + if (!prop_name) { + *resolved = false; + return true; // not resolved, but no error + } + // Look for methods and other class properties GjsAutoFunctionInfo method_info = - g_struct_info_find_method(info(), prop_name); + g_struct_info_find_method(info(), prop_name.get()); if (!method_info) { *resolved = false; return true; diff -Nru gjs-1.64.3/gi/boxed.h gjs-1.64.5/gi/boxed.h --- gjs-1.64.3/gi/boxed.h 2020-05-31 17:42:30.596444100 +0000 +++ gjs-1.64.5/gi/boxed.h 2021-01-09 22:53:50.229958500 +0000 @@ -147,7 +147,7 @@ private: GJS_JSAPI_RETURN_CONVENTION bool resolve_impl(JSContext* cx, JS::HandleObject obj, JS::HandleId id, - const char* prop_name, bool* resolved); + bool* resolved); void trace_impl(JSTracer* trc); // Helper methods diff -Nru gjs-1.64.3/gi/fundamental.cpp gjs-1.64.5/gi/fundamental.cpp --- gjs-1.64.3/gi/fundamental.cpp 2020-05-31 17:42:30.597444000 +0000 +++ gjs-1.64.5/gi/fundamental.cpp 2021-01-09 22:53:50.230958500 +0000 @@ -153,11 +153,18 @@ // See GIWrapperBase::resolve(). bool FundamentalPrototype::resolve_impl(JSContext* cx, JS::HandleObject obj, - JS::HandleId, const char* prop_name, - bool* resolved) { + JS::HandleId id, bool* resolved) { + JS::UniqueChars prop_name; + if (!gjs_get_string_id(cx, id, &prop_name)) + return false; + if (!prop_name) { + *resolved = false; + return true; // not resolved, but no error + } + /* We are the prototype, so look for methods and other class properties */ GjsAutoFunctionInfo method_info = - g_object_info_find_method(info(), prop_name); + g_object_info_find_method(info(), prop_name.get()); if (method_info) { #if GJS_VERBOSE_ENABLE_GI_USAGE @@ -187,7 +194,7 @@ *resolved = false; } - return resolve_interface(cx, obj, resolved, prop_name); + return resolve_interface(cx, obj, resolved, prop_name.get()); } /* diff -Nru gjs-1.64.3/gi/fundamental.h gjs-1.64.5/gi/fundamental.h --- gjs-1.64.3/gi/fundamental.h 2020-05-31 17:42:30.597444000 +0000 +++ gjs-1.64.5/gi/fundamental.h 2021-01-09 22:53:50.230958500 +0000 @@ -138,7 +138,7 @@ GJS_JSAPI_RETURN_CONVENTION bool resolve_impl(JSContext* cx, JS::HandleObject obj, JS::HandleId id, - const char* prop_name, bool* resolved); + bool* resolved); void trace_impl(JSTracer* trc); // Public API diff -Nru gjs-1.64.3/gi/interface.cpp gjs-1.64.5/gi/interface.cpp --- gjs-1.64.3/gi/interface.cpp 2020-05-31 17:42:30.599444200 +0000 +++ gjs-1.64.5/gi/interface.cpp 2021-01-09 22:53:50.231958400 +0000 @@ -51,8 +51,7 @@ // See GIWrapperBase::resolve(). bool InterfacePrototype::resolve_impl(JSContext* context, JS::HandleObject obj, - JS::HandleId, const char* name, - bool* resolved) { + JS::HandleId id, bool* resolved) { /* If we have no GIRepository information then this interface was defined * from within GJS. In that case, it has no properties that need to be * resolved from within C code, as interfaces cannot inherit. */ @@ -61,8 +60,16 @@ return true; } + JS::UniqueChars prop_name; + if (!gjs_get_string_id(context, id, &prop_name)) + return false; + if (!prop_name) { + *resolved = false; + return true; // not resolved, but no error + } + GjsAutoFunctionInfo method_info = - g_interface_info_find_method(m_info, name); + g_interface_info_find_method(m_info, prop_name.get()); if (method_info) { if (g_function_info_get_flags (method_info) & GI_FUNCTION_IS_METHOD) { diff -Nru gjs-1.64.3/gi/interface.h gjs-1.64.5/gi/interface.h --- gjs-1.64.3/gi/interface.h 2020-05-31 17:42:30.599444200 +0000 +++ gjs-1.64.5/gi/interface.h 2021-01-09 22:53:50.231958400 +0000 @@ -109,7 +109,7 @@ GJS_JSAPI_RETURN_CONVENTION bool resolve_impl(JSContext* cx, JS::HandleObject obj, JS::HandleId id, - const char* name, bool* resolved); + bool* resolved); // JS methods diff -Nru gjs-1.64.3/gi/object.cpp gjs-1.64.5/gi/object.cpp --- gjs-1.64.3/gi/object.cpp 2020-05-31 17:42:30.600444000 +0000 +++ gjs-1.64.5/gi/object.cpp 2021-01-09 22:53:50.232958600 +0000 @@ -765,14 +765,21 @@ } bool ObjectPrototype::resolve_impl(JSContext* context, JS::HandleObject obj, - JS::HandleId id, const char* name, - bool* resolved) { + JS::HandleId id, bool* resolved) { if (m_unresolvable_cache.has(id)) { *resolved = false; return true; } - if (!uncached_resolve(context, obj, id, name, resolved)) + JS::UniqueChars prop_name; + if (!gjs_get_string_id(context, id, &prop_name)) + return false; + if (!prop_name) { + *resolved = false; + return true; // not resolved, but no error + } + + if (!uncached_resolve(context, obj, id, prop_name.get(), resolved)) return false; if (!*resolved && !m_unresolvable_cache.putNew(id)) { diff -Nru gjs-1.64.3/gi/object.h gjs-1.64.5/gi/object.h --- gjs-1.64.3/gi/object.h 2020-05-31 17:42:30.600444000 +0000 +++ gjs-1.64.5/gi/object.h 2021-01-09 22:53:50.232958600 +0000 @@ -305,7 +305,7 @@ private: GJS_JSAPI_RETURN_CONVENTION bool resolve_impl(JSContext* cx, JS::HandleObject obj, JS::HandleId id, - const char* prop_name, bool* resolved); + bool* resolved); GJS_JSAPI_RETURN_CONVENTION bool new_enumerate_impl(JSContext* cx, JS::HandleObject obj, diff -Nru gjs-1.64.3/gi/union.cpp gjs-1.64.5/gi/union.cpp --- gjs-1.64.3/gi/union.cpp 2020-05-31 17:42:30.600444000 +0000 +++ gjs-1.64.5/gi/union.cpp 2021-01-09 22:53:50.232958600 +0000 @@ -62,11 +62,18 @@ // See GIWrapperBase::resolve(). bool UnionPrototype::resolve_impl(JSContext* context, JS::HandleObject obj, - JS::HandleId, const char* prop_name, - bool* resolved) { + JS::HandleId id, bool* resolved) { + JS::UniqueChars prop_name; + if (!gjs_get_string_id(context, id, &prop_name)) + return false; + if (!prop_name) { + *resolved = false; + return true; // not resolved, but no error + } + // Look for methods and other class properties GjsAutoFunctionInfo method_info = - g_union_info_find_method(info(), prop_name); + g_union_info_find_method(info(), prop_name.get()); if (method_info) { #if GJS_VERBOSE_ENABLE_GI_USAGE diff -Nru gjs-1.64.3/gi/union.h gjs-1.64.5/gi/union.h --- gjs-1.64.3/gi/union.h 2020-05-31 17:42:30.601444000 +0000 +++ gjs-1.64.5/gi/union.h 2021-01-09 22:53:50.232958600 +0000 @@ -73,7 +73,7 @@ GJS_JSAPI_RETURN_CONVENTION bool resolve_impl(JSContext* cx, JS::HandleObject obj, JS::HandleId id, - const char* prop_name, bool* resolved); + bool* resolved); // Overrides GIWrapperPrototype::constructor_nargs(). GJS_USE unsigned constructor_nargs(void) const { return 0; } diff -Nru gjs-1.64.3/gi/wrapperutils.h gjs-1.64.5/gi/wrapperutils.h --- gjs-1.64.3/gi/wrapperutils.h 2020-05-31 17:42:30.601444000 +0000 +++ gjs-1.64.5/gi/wrapperutils.h 2021-01-09 22:53:50.233958500 +0000 @@ -445,18 +445,7 @@ return true; } - // A GObject-introspection lazy property will always be a string, so - // also bail out if trying to resolve an integer or symbol property. - JS::UniqueChars prop_name; - if (!gjs_get_string_id(cx, id, &prop_name)) - return false; - if (!prop_name) { - *resolved = false; - return true; // not resolved, but no error - } - - return priv->to_prototype()->resolve_impl(cx, obj, id, prop_name.get(), - resolved); + return priv->to_prototype()->resolve_impl(cx, obj, id, resolved); } /* diff -Nru gjs-1.64.3/installed-tests/js/testGObject.js gjs-1.64.5/installed-tests/js/testGObject.js --- gjs-1.64.3/installed-tests/js/testGObject.js 2020-05-31 17:42:30.608444000 +0000 +++ gjs-1.64.5/installed-tests/js/testGObject.js 2021-01-09 22:53:50.239958500 +0000 @@ -48,3 +48,14 @@ }); }); }); + +describe('GObject should', function () { + const types = ['gpointer', 'GBoxed', 'GParam', 'GInterface', 'GObject', 'GVariant']; + + types.forEach(type => { + it(`be able to create a GType object for ${type}`, function () { + const gtype = GObject.Type(type); + expect(gtype.name).toEqual(type); + }); + }); +}); diff -Nru gjs-1.64.3/installed-tests/js/testGtk4.js gjs-1.64.5/installed-tests/js/testGtk4.js --- gjs-1.64.3/installed-tests/js/testGtk4.js 2020-05-31 17:42:30.608444000 +0000 +++ gjs-1.64.5/installed-tests/js/testGtk4.js 2021-01-09 22:53:50.239958500 +0000 @@ -1,8 +1,7 @@ imports.gi.versions.Gtk = '4.0'; const ByteArray = imports.byteArray; -const {GLib, Gio, GObject, Gtk} = imports.gi; -const System = imports.system; +const {Gio, GObject, Gtk} = imports.gi; // This is ugly here, but usually it would be in a resource function createTemplate(className) { @@ -118,7 +117,7 @@ content = new ClassName(); content.label_child.emit('copy-clipboard'); content.label_child2.emit('copy-clipboard'); - win.add(content); + win.set_child(content); }); it('sets up internal and public template children', function () { @@ -167,26 +166,6 @@ expect(Gtk.Widget.get_css_name.call(MyComplexGtkSubclass)).toEqual('complex-subclass'); }); - it('avoid crashing when GTK vfuncs are called in garbage collection', function () { - GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_CRITICAL, - '*during garbage collection*'); - GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_CRITICAL, - '*destroy*'); - - let BadLabel = GObject.registerClass(class BadLabel extends Gtk.Label { - vfunc_destroy() {} - }); - - let w = new Gtk.Window(); - w.add(new BadLabel()); - - w.destroy(); - System.gc(); - - GLib.test_assert_expected_messages_internal('Gjs', 'testGtk4.js', 0, - 'Gtk overrides avoid crashing and print a stack trace'); - }); - it('can create a Gtk.TreeIter with accessible stamp field', function () { const iter = new Gtk.TreeIter(); iter.stamp = 42; diff -Nru gjs-1.64.3/meson.build gjs-1.64.5/meson.build --- gjs-1.64.3/meson.build 2020-05-31 17:42:30.610444000 +0000 +++ gjs-1.64.5/meson.build 2021-01-09 22:53:50.241958600 +0000 @@ -1,4 +1,4 @@ -project('gjs', 'cpp', 'c', version: '1.64.3', license: ['MIT', 'LGPL2+'], +project('gjs', 'cpp', 'c', version: '1.64.5', license: ['MIT', 'LGPL2+'], meson_version: '>= 0.50.0', default_options: ['cpp_std=c++14', 'c_std=c99', 'warning_level=2']) @@ -457,6 +457,10 @@ endif endif +if build_readline + libgjs_dependencies += readline_deps +endif + if build_profiler libgjs_dependencies += profiler_deps endif diff -Nru gjs-1.64.3/modules/core/overrides/GObject.js gjs-1.64.5/modules/core/overrides/GObject.js --- gjs-1.64.3/modules/core/overrides/GObject.js 2020-05-31 17:42:30.612444000 +0000 +++ gjs-1.64.5/modules/core/overrides/GObject.js 2021-01-09 22:53:50.243958500 +0000 @@ -243,7 +243,7 @@ let gtype = GObject.type_from_name(gtypeName); obj[`TYPE_${upperName}`] = gtype; obj[name] = function (v) { - return new actual(v); + return actual(v); }; obj[name].$gtype = gtype; } diff -Nru gjs-1.64.3/modules/core/overrides/Gtk.js gjs-1.64.5/modules/core/overrides/Gtk.js --- gjs-1.64.3/modules/core/overrides/Gtk.js 2020-05-31 17:42:30.612444000 +0000 +++ gjs-1.64.5/modules/core/overrides/Gtk.js 2021-01-09 22:53:50.243958500 +0000 @@ -45,10 +45,7 @@ Gtk.Widget.prototype._init = function (params) { if (this.constructor[Gtk.template]) { - if (BuilderScope) { - Gtk.Widget.set_template_scope.call(this.constructor, - new BuilderScope(this)); - } else { + if (!BuilderScope) { Gtk.Widget.set_connect_func.call(this.constructor, (builder, obj, signalName, handlerName, connectObj, flags) => { const swapped = flags & GObject.ConnectFlags.SWAPPED; @@ -110,6 +107,9 @@ } else { Gtk.Widget.set_template.call(klass, template); } + + if (BuilderScope) + Gtk.Widget.set_template_scope.call(klass, new BuilderScope()); } if (children) { @@ -129,15 +129,11 @@ BuilderScope = GObject.registerClass({ Implements: [Gtk.BuilderScope], }, class extends GObject.Object { - _init(thisArg) { - super._init(); - this._this = thisArg; - } - vfunc_create_closure(builder, handlerName, flags, connectObject) { const swapped = flags & Gtk.BuilderClosureFlags.SWAPPED; return _createClosure( - builder, this._this, handlerName, swapped, connectObject); + builder, builder.get_current_object(), + handlerName, swapped, connectObject); } }); } diff -Nru gjs-1.64.3/NEWS gjs-1.64.5/NEWS --- gjs-1.64.3/NEWS 2020-05-31 17:42:30.593444000 +0000 +++ gjs-1.64.5/NEWS 2021-01-09 22:53:50.226958500 +0000 @@ -1,3 +1,26 @@ +Version 1.64.5 +-------------- + +- Performance improvements and crash fixes backported from the development + branch. + +- Bug fixes enabling use of GTK 4. + +- Closed bugs and merge requests: + + * Error in function "_init()" in module "modules/overrides/GObject.js" [#238, + !508, Nina Pypchenko] + * gi/wrapperutils: Move gjs_get_string_id() into resolve() implementations + [!513, Jonas Dreßler] + * overrides/Gtk: Set BuilderScope in class init [!527, Florian Müllner] + * fix readline build on certain systems [!543, Jakub Kulík] + +Version 1.64.4 +-------------- + +- Closed bugs and merge requests: + * Fix CI failure caused by GTK4 update [!447, Philip Chimento] + Version 1.64.3 --------------