Hello community, here is the log from the commit of package lua-lgi for openSUSE:Factory checked in at 2018-04-05 15:34:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua-lgi (Old) and /work/SRC/openSUSE:Factory/.lua-lgi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua-lgi" Thu Apr 5 15:34:18 2018 rev:7 rq:593625 version:0.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/lua-lgi/lua-lgi.changes 2017-10-31 15:44:02.493683709 +0100 +++ /work/SRC/openSUSE:Factory/.lua-lgi.new/lua-lgi.changes 2018-04-05 15:34:23.978173485 +0200 @@ -1,0 +2,19 @@ +Wed Apr 4 12:06:12 UTC 2018 - [email protected] + +- Update to version 0.9.2: + * Fix assorted crashes in closure callback invocation code. + * Fix a double-free bug caused by incorrect annotation of + Gio.DBusProxy.get_interface_info. + * Fix marshaling of arrays of pointers. + * Make objects unusable in __gc metamethod. + * Work around an API break in GLib 2.54. + * Use structured GLib logging when available. + * Add Gio.Async support also for static methods and global + functions. + * A better error message when Gtk.init fails. + * Add support for Travis. + * Do not hardcode the pkg-config executable. + * Fix URI in GStreamer sample. + * Fix flags for D-Bus samples. + +------------------------------------------------------------------- Old: ---- lgi-0.9.1.tar.gz New: ---- lgi-0.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua-lgi.spec ++++++ --- /var/tmp/diff_new_pack.DA3n9A/_old 2018-04-05 15:34:24.970137634 +0200 +++ /var/tmp/diff_new_pack.DA3n9A/_new 2018-04-05 15:34:24.970137634 +0200 @@ -1,7 +1,7 @@ # # spec file for package lua-lgi # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2012 Adam Mizerski <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -19,12 +19,12 @@ %define flavor @BUILD_FLAVOR@ %define mod_name lgi -Version: 0.9.1 +Version: 0.9.2 Release: 0 Summary: Lua bindings to GObject libraries License: MIT Group: Development/Languages/Other -Url: https://github.com/pavouk/lgi +URL: https://github.com/pavouk/lgi Source0: https://github.com/pavouk/%{mod_name}/archive/%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz BuildRequires: %{flavor}-devel BuildRequires: pkgconfig @@ -61,7 +61,7 @@ %setup -q -n %{mod_name}-%{version} %build -make %{?_smp_mflags} \ +make %{?_smp_mflags} V=1 \ LUA_CFLAGS=" -I%{lua_incdir}" \ COPTFLAGS="%{optflags}" \ @@ -72,7 +72,12 @@ LUA_SHAREDIR=%{lua_noarchdir} %files -%doc LICENSE README.md +%if 0%{?suse_version} >= 1500 +%license LICENSE +%else +%doc LICENSE +%endif +%doc README.md %{lua_archdir}/%{mod_name}/ %{lua_noarchdir}/%{mod_name}.lua %{lua_noarchdir}/%{mod_name}/ ++++++ lgi-0.9.1.tar.gz -> lgi-0.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/.travis.yml new/lgi-0.9.2/.travis.yml --- old/lgi-0.9.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/lgi-0.9.2/.travis.yml 2017-10-09 20:55:55.000000000 +0200 @@ -0,0 +1,60 @@ +sudo: required +dist: trusty +language: c +env: + matrix: + - LUA=5.1 LUANAME=luajit-2.0 + - LUA=5.1 LUANAME=lua5.1 + - LUA=5.2 LUANAME=lua5.2 + - LUA=5.3 LUANAME=lua5.3 + +before_install: + - if [ -z $LUAINCLUDE ]; then LUAINCLUDE=/usr/include/${LUANAME}; fi + +install: + # Travis boilerplate: the apt-get cache might be out of date. + - travis_retry sudo apt-get update -qq + + # Do not install recommended packages with apt-get. + - echo 'APT::Install-Recommends "false";' | sudo tee /etc/apt/apt.conf.d/no-recommends + + # Install build dependencies + - travis_retry sudo apt-get install -y libgirepository1.0-dev libcairo2-dev gir1.2-gtk-3.0 libffi-dev libglib2.0-dev + # And dependencies for running tests + - travis_retry sudo apt-get install -y xvfb dbus-x11 + + # Install Lua (per env). + # Note that Lua 5.3 is installed manually, because it is not available in Ubuntu Trusty. + # For this we enable LUA_USE_APICHECK to catch errors in Lua API use. + # LuaJIT is also installed manually. + - | + set -ev + if [[ "$LUA" == "5.3" ]]; then + travis_retry wget http://www.lua.org/ftp/lua-5.3.3.tar.gz -O lua.tar.gz + tar -xvzf lua.tar.gz + (cd lua-5.3.3/src \ + && make SYSCFLAGS="-DLUA_USE_LINUX -ULUA_COMPAT_5_2 -DLUA_USE_APICHECK" SYSLIBS="-Wl,-E -ldl -lreadline" LUA_A=liblua.so MYCFLAGS="-fPIC" RANLIB=: AR="gcc -shared -ldl -o" liblua.so \ + && cd .. \ + && sudo make INSTALL_TOP=/usr/ INSTALL_INC=${LUAINCLUDE} TO_LIB=liblua.so linux install) + elif [[ "$LUANAME" == "luajit-2.0" ]]; then + travis_retry git clone http://luajit.org/git/luajit-2.0.git + (cd luajit-2.0 && sudo make install PREFIX=/usr) + + # "Create" /usr/bin/lua if needed (Yup, this is a bad hack) + if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/luajit /usr/bin/lua; fi + else + sudo apt-get install -y lib${LUANAME}-dev ${LUANAME} + fi + + +script: + # The tests need an enum value that is new in version 2.44. Of course Ubuntu + # Ancient (=Trusty) as used by Travis only has version 2.40.0. + - sed -e 's/Gio.NetworkConnectivity.LOCAL/1/' -i tests/gobject.lua + + # Build everything and run the tests + - xvfb-run -a make check LUA_CFLAGS="-I$LUAINCLUDE" + + # Just to also check make install + - sudo make install LUA_VERSION="$LUA" + - xvfb-run -a lua -e 'Gtk = require("lgi").Gtk c = Gtk.Grid() w = Gtk.Label() c:add(w) assert(w.parent == c) a, b = dofile("lgi/version.lua"), require("lgi.version") assert(a == b, string.format("%s == %s", a, b))' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/Makefile new/lgi-0.9.2/Makefile --- old/lgi-0.9.1/Makefile 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/Makefile 2017-10-09 20:55:55.000000000 +0200 @@ -5,7 +5,7 @@ # License: MIT # -VERSION = 0.9.1 +VERSION = 0.9.2 MAKE ?= make ROCK = lgi-$(VERSION)-1.rockspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/README.md new/lgi-0.9.2/README.md --- old/lgi-0.9.1/README.md 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/README.md 2017-10-09 20:55:55.000000000 +0200 @@ -10,7 +10,7 @@ Home of the project is on [GitHub](http://github.com/pavouk/lgi). -LGI is tested and compatible with standard Lua 5.1, Lua 5.2 and +LGI is tested and compatible with standard Lua 5.1, Lua 5.2, Lua 5.3 and LuaJIT2. Compatibility with other Lua implementations is not tested yet. @@ -59,6 +59,10 @@ - Garrett Regier - Kenneth Zhou - Travis Hoppe +- Tobias Jakobs +- Heiko Becker +- Vincent Bermel +- Szunti Many other people contributed to what lgi is today, in many forms - writing patches, reporting bugs, packaging for distributions, @@ -66,6 +70,21 @@ ## History +### 0.9.2 (9-Oct-2017) + + - fix assorted crashes in closure callback invocation code + - fix double-free bug caused by incorrect annotation of Gio.DBusProxy.get_interface_info + - fix marshaling of arrays of pointers + - make objects unusable in __gc metamethod + - work around API break in GLib 2.54 + - use structured GLib logging when available + - add Gio.Async support also for static methods and global functions + - better error message when Gtk.init fails + - add support for Travis + - don't hardcode pkg-config executable + - fix URI in GStreamer sample + - fix flags for DBus samples + ### 0.9.1 (27-May-2016) - marshal NULL strings as nil instead of empty strings. This allows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/Makefile new/lgi-0.9.2/lgi/Makefile --- old/lgi-0.9.1/lgi/Makefile 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/Makefile 2017-10-09 20:55:55.000000000 +0200 @@ -25,7 +25,7 @@ CORE = corelgilua51.so LIBFLAG = -bundle -undefined dynamic_lookup CCSHARED = -fno-common -GOBJECT_INTROSPECTION_LIBDIR = $(shell pkg-config --variable=libdir $(GINAME)) +GOBJECT_INTROSPECTION_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir $(GINAME)) else CORE = corelgilua51.so LIBFLAG = -shared diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/callable.c new/lgi-0.9.2/lgi/callable.c --- old/lgi-0.9.1/lgi/callable.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/callable.c 2017-10-09 20:55:55.000000000 +0200 @@ -651,6 +651,10 @@ callable_param_destroy (&callable->params[i]); callable_param_destroy (&callable->retval ); + + /* Unset the metatable / make the callable unusable */ + lua_pushnil (L); + lua_setmetatable (L, 1); return 0; } @@ -1101,13 +1105,13 @@ gint res = 0, npos, i, stacktop; gboolean call; Param *param; + lua_State *L; (void)cif; /* Get access to proper Lua context. */ - lua_State *L = block->callback.L; lgi_state_enter (block->callback.state_lock); - lua_rawgeti (L, LUA_REGISTRYINDEX, block->callback.thread_ref); - L = lua_tothread (L, -1); + lua_rawgeti (block->callback.L, LUA_REGISTRYINDEX, block->callback.thread_ref); + L = lua_tothread (block->callback.L, -1); call = (closure->target_ref != LUA_NOREF); if (call) { @@ -1120,8 +1124,9 @@ the routine we are about to call is actually going to resume it. Create new thread instead and switch closure to its context. */ - L = lua_newthread (L); + lua_State *newL = lua_newthread (L); lua_rawseti (L, LUA_REGISTRYINDEX, block->callback.thread_ref); + L = newL; } lua_pop (block->callback.L, 1); block->callback.L = L; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/component.lua new/lgi-0.9.2/lgi/component.lua --- old/lgi-0.9.1/lgi/component.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/component.lua 2017-10-09 20:55:55.000000000 +0200 @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------ -- --- LGI Basic repo type component implementation +-- lgi Basic repo type component implementation -- --- Copyright (c) 2010, 2011, 2012, 2013 Pavel Holejsovsky +-- Copyright (c) 2010, 2011, 2012, 2013, 2016 Pavel Holejsovsky -- Licensed under the MIT license: -- http://www.opensource.org/licenses/mit-license.php -- @@ -152,7 +152,7 @@ end -- Implementation of _access method, which is called by _core when --- repo instance is accessed for reading or writing. +-- instance of repo-based type is accessed for reading or writing. function component.mt:_access(instance, symbol, ...) -- Invoke _element, which converts symbol to element and category. local element, category = self:_element(instance, symbol) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/core.c new/lgi-0.9.2/lgi/core.c --- old/lgi-0.9.1/lgi/core.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/core.c 2017-10-09 20:55:55.000000000 +0200 @@ -380,7 +380,14 @@ const char *domain = luaL_checkstring (L, 1); int level = 1 << (luaL_checkoption (L, 2, log_levels[5], log_levels) + 2); const char *message = luaL_checkstring (L, 3); + +#if GLIB_CHECK_VERSION(2, 50, 0) + /* TODO: We can include more debug information such as lua line numbers */ + g_log_structured (domain, level, "MESSAGE", "%s", message); +#else g_log (domain, level, "%s", message); +#endif + return 0; } @@ -474,6 +481,10 @@ { GModule **module = luaL_checkudata (L, 1, UD_MODULE); g_module_close (*module); + + /* Unset the metatable / make the module unusable */ + lua_pushnil (L); + lua_setmetatable (L, 1); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/gi.c new/lgi-0.9.2/lgi/gi.c --- old/lgi-0.9.1/lgi/gi.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/gi.c 2017-10-09 20:55:55.000000000 +0200 @@ -109,6 +109,10 @@ { Infos *infos = luaL_checkudata (L, 1, LGI_GI_INFOS); g_base_info_unref (infos->info); + + /* Unset the metatable / make the infos unusable */ + lua_pushnil (L); + lua_setmetatable (L, 1); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/marshal.c new/lgi-0.9.2/lgi/marshal.c --- old/lgi-0.9.1/lgi/marshal.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/marshal.c 2017-10-09 20:55:55.000000000 +0200 @@ -1359,9 +1359,9 @@ { GIArrayType atype = g_type_info_get_array_type (ti); gssize size = -1; + gpointer ptr = g_type_info_is_pointer (ti) ? arg->v_pointer : arg; array_get_or_set_length (ti, &size, 0, ci, args); - marshal_2lua_array (L, ti, dir, atype, transfer, arg->v_pointer, size, - parent); + marshal_2lua_array (L, ti, dir, atype, transfer, ptr, size, parent); } break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/namespace.lua new/lgi-0.9.2/lgi/namespace.lua --- old/lgi-0.9.1/lgi/namespace.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/namespace.lua 2017-10-09 20:55:55.000000000 +0200 @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------ -- --- LGI Support for repository namespace +-- lgi Support for repository namespace -- --- Copyright (c) 2010, 2011 Pavel Holejsovsky +-- Copyright (c) 2010, 2011,2016 Pavel Holejsovsky -- Licensed under the MIT license: -- http://www.opensource.org/licenses/mit-license.php -- @@ -61,7 +61,9 @@ local namespace = { mt = { _categories = { '_class', '_interface', '_struct', '_union', '_enum', - '_function', '_constant', } } + '_function', '_constant', }, + _category_mt = {}, + } } -- Gets symbol of the specified namespace, if not present yet, tries to load it @@ -103,7 +105,12 @@ if val then local cat = rawget(self, category) if not cat then - cat = {} + local mt = namespace.mt._category_mt[category] + if not mt then + mt = {} + namespace.mt._category_mt[category] = mt + end + cat = setmetatable({ _namespace = self }, mt) self[category] = cat end -- Store symbol into the repo, but only if it is not already @@ -176,6 +183,11 @@ require(override_name) end end + if ok and type(msg) == "string" then + -- It's an error message for something that does not want to be + -- re-loaded, see e.g. the call to Gtk.init_check() in Gtk.lua. + error(msg) + end end return ns end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/object.c new/lgi-0.9.2/lgi/object.c --- old/lgi-0.9.1/lgi/object.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/object.c 2017-10-09 20:55:55.000000000 +0200 @@ -266,6 +266,10 @@ object_gc (lua_State *L) { object_unref (L, object_get (L, 1)); + + /* Unset the metatable / make the object unusable */ + lua_pushnil (L); + lua_setmetatable (L, 1); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/override/GObject-Object.lua new/lgi-0.9.2/lgi/override/GObject-Object.lua --- old/lgi-0.9.1/lgi/override/GObject-Object.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/override/GObject-Object.lua 2017-10-09 20:55:55.000000000 +0200 @@ -38,7 +38,10 @@ -- Object constructor, 'param' contains table _with properties/signals -- to initialize. local parameter_repo = repo.GObject.Parameter -local object_new = gi.GObject.Object.methods.new +-- Before GLib 2.54, g_object_newv() was annotated with [rename-to g_object_new]. +-- Starting from GLib 2.54, g_object_new_with_properties() has this annotation. +-- We always want g_object_newv(). +local object_new = gi.GObject.Object.methods.newv or gi.GObject.Object.methods.new if object_new then object_new = core.callable.new(object_new) else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/override/Gio-DBus.lua new/lgi-0.9.2/lgi/override/Gio-DBus.lua --- old/lgi-0.9.1/lgi/override/Gio-DBus.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/override/Gio-DBus.lua 2017-10-09 20:55:55.000000000 +0200 @@ -69,3 +69,14 @@ self:generate_xml(0, xml) return xml.str end + +-- g_dbus_proxy_get_interface_info() is documented as "Do not unref the returned +-- object", but has transfer=full. Fix this. +if core.gi.Gio.DBusProxy.methods.get_interface_info.return_transfer ~= 'none' then + Gio.DBusProxy.get_interface_info = core.callable.new { + addr = core.gi.Gio.resolve.g_dbus_proxy_get_interface_info, + name = 'DBusProxy.get_interface_info', + ret = Gio.DBusInterfaceInfo, + core.gi.Gio.DBusProxy.methods.new_sync.return_type, + } +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/override/Gio.lua new/lgi-0.9.2/lgi/override/Gio.lua --- old/lgi-0.9.1/lgi/override/Gio.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/override/Gio.lua 2017-10-09 20:55:55.000000000 +0200 @@ -2,7 +2,7 @@ -- -- lgi Gio override module. -- --- Copyright (c) 2010, 2011, 2013 Pavel Holejsovsky +-- Copyright (c) 2010, 2011, 2013, 2016 Pavel Holejsovsky -- Licensed under the MIT license: -- http://www.opensource.org/licenses/mit-license.php -- @@ -18,6 +18,8 @@ local Gio = lgi.Gio local component = require 'lgi.component' +local class = require 'lgi.class' +local namespace = require 'lgi.namespace' local core = require 'lgi.core' local gi = core.gi @@ -100,22 +102,18 @@ -- xxx_async()/xxx_finish() sequence using currently running -- coroutine. local tag_int = gi.GObject.ParamSpecEnum.fields.default_value.typeinfo.tag -local inherited_element = GObject.Object._element -function GObject.Object:_element(object, name) - local element, category = inherited_element(self, object, name) - if element or not object then return element, category end - +local function async_element(name, accessor, param_self, param_object) -- Check, whether we have async_xxx request. - local name_root = name:match('^async_(.+)$') + local name_root = type(name) == 'string' and name:match('^async_(.+)$') if name_root then - local async = inherited_element(self, object, name_root .. '_async') - local finish = inherited_element(self, object, name_root .. '_finish') + local async = accessor(param_self, param_object, name_root .. '_async') + local finish = accessor(param_self, param_object, name_root .. '_finish') -- Some clients name async method just 'name' and use -- 'name_sync' for synchronous variant. - if finish and not async - and inherited_element(self, object, name_root .. '_sync') then - async = inherited_element(self, object, name_root) + if finish and not async and accessor(param_self, param_object, + name_root .. '_sync') then + async = accessor(param_self, param_object, name_root) end -- We have async/finish pair, create element table containing @@ -147,12 +145,7 @@ end end -function GObject.Object:_access_async(object, element, ...) - if select('#', ...) > 0 then - error(("%s: `%s' not writable"):format( - core.object.query(object, 'repo')._name, name)) - end - +local function async_access(element, process_yield) -- Generate wrapper method calling _async/_finish pair automatically. return function(...) -- Check that we are running inside context. @@ -177,8 +170,44 @@ args[element.in_args] = coroutine.running() element.async(unpack(args, 1, element.in_args)) - return element.finish(coroutine.yield()) + return element.finish(process_yield(coroutine.yield())) + end +end + +local inherited_class_element = class.class_mt._element +function class.class_mt:_element(object, name) + local element, category = inherited_class_element(self, object, name) + if element then return element, category end + return async_element(name, inherited_class_element, self, object) +end + +function class.class_mt:_index_async(element) + return async_access(element, function(_, ...) return ... end) +end + +local inherited_gobject_element = GObject.Object._element +function GObject.Object:_element(object, name) + local element, category = inherited_gobject_element(self, object, name) + if element then return element, category end + return async_element(name, inherited_gobject_element, self, object) +end + +function GObject.Object:_access_async(object, element, ...) + if select('#', ...) > 0 then + error(("%s: `%s' not writable"):format( + core.object.query(object, 'repo')._name, name)) end + + return async_access(element, function(...) return ... end) +end + +-- Enforce that Gio._function category is already created +local _ = Gio.bus_get +function namespace.mt._category_mt._function:__index(key) + local element = async_element(key, function(_, _, name) + return self._namespace[name] + end) + return element and async_access(element, function(_, ...) return ... end) end function Gio.Initable._init2(object) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/override/GooCanvas.lua new/lgi-0.9.2/lgi/override/GooCanvas.lua --- old/lgi-0.9.1/lgi/override/GooCanvas.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/lgi-0.9.2/lgi/override/GooCanvas.lua 2017-10-09 20:55:55.000000000 +0200 @@ -0,0 +1,34 @@ +------------------------------------------------------------------------------ +-- +-- lgi GooCanvas override module. +-- +-- Copyright (c) 2017 Pavel Holejsovsky +-- Licensed under the MIT license: +-- http://www.opensource.org/licenses/mit-license.php +-- +------------------------------------------------------------------------------ + +local select, type, pairs, setmetatable, error + = select, type, pairs, setmetatable, error +local lgi = require 'lgi' +local Goo = lgi.GooCanvas + + +Goo.Canvas._attribute = { + root_item = Goo.Canvas.get_root_item, + root_item_model = Goo.Canvas.get_root_item_model, + static_root_item = Goo.Canvas.get_static_root_item, + static_root_item_model = Goo.Canvas.get_static_root_item_model, +} + +-- Remove 'parent' field from implementation classes because it +-- clashes with 'parent' field defined in implementations of +-- CanvasItem interface. +for _, class in pairs { + Goo.CanvasEllipse, Goo.CanvasGrid, Goo.CanvasGroup, Goo.CanvasImage, + Goo.CanvasItemSimple, Goo.CanvasPath, Goo.CanvasPolyline, + Goo.CanvasRect, Goo.CanvasTable, Goo.CanvasText, Goo.CanvasWidget, +} do + local _ = class._field.parent + class._field.parent = nil +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/override/Gtk.lua new/lgi-0.9.2/lgi/override/Gtk.lua --- old/lgi-0.9.1/lgi/override/Gtk.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/override/Gtk.lua 2017-10-09 20:55:55.000000000 +0200 @@ -21,7 +21,9 @@ -- Initialize GTK. Gtk.disable_setlocale() -assert(Gtk.init_check()) +if not Gtk.init_check() then + return "gtk_init_check() failed" +end -- Gtk.Allocation is just an alias to Gdk.Rectangle. Gtk.Allocation = Gdk.Rectangle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/lgi/record.c new/lgi-0.9.2/lgi/record.c --- old/lgi-0.9.1/lgi/record.c 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/lgi/record.c 2017-10-09 20:55:55.000000000 +0200 @@ -445,6 +445,9 @@ lua_rawset (L, LUA_REGISTRYINDEX); } + /* Unset the metatable / make the record unusable */ + lua_pushnil (L); + lua_setmetatable (L, 1); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/samples/GDbus/list-system-services.lua new/lgi-0.9.2/samples/GDbus/list-system-services.lua --- old/lgi-0.9.1/samples/GDbus/list-system-services.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/samples/GDbus/list-system-services.lua 2017-10-09 20:55:55.000000000 +0200 @@ -87,7 +87,7 @@ 'ListNames', nil, nil, - Gio.DBusConnectionFlags.NONE, + Gio.DBusCallFlags.NONE, -1) -- We know that ListNames returns '(as)' local services = var[1].value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/samples/goocanvas.lua new/lgi-0.9.2/samples/goocanvas.lua --- old/lgi-0.9.1/samples/goocanvas.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/lgi-0.9.2/samples/goocanvas.lua 2017-10-09 20:55:55.000000000 +0200 @@ -0,0 +1,49 @@ +local lgi = require 'lgi' +local Gtk = lgi.Gtk +local Goo = lgi.GooCanvas + +local window = Gtk.Window { + on_delete_event = Gtk.main_quit, + Gtk.ScrolledWindow { + shadow_type = 'IN', + Goo.Canvas { + id = 'canvas', + width = 600, height = 450, + } + }, +} + +window:set_default_size(640, 600) +window:show_all() + +window.child.canvas:set_bounds(0, 0, 1000, 1000) +local root = window.child.canvas.root_item + +local rect_item = Goo.CanvasRect { + parent = root, + x = 100, y = 100, + width = 400, height = 400, + + line_width = 10, + stroke_color = 'yellow', + fill_color = 'red', + radius_x = 20, + radius_y = 10, + + on_button_press_event = function () + print("rect item received button press event") + end +} + +local text_item = Goo.CanvasText { + parent = root, + x = 300, y = 300, + width = -1, + + text = "Hello World", + anchor = 'CENTER', + font = 'Sans 24', +} +text_item:rotate(45, 300, 300) + +Gtk.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/samples/gstplaystream.lua new/lgi-0.9.2/samples/gstplaystream.lua --- old/lgi-0.9.1/samples/gstplaystream.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/samples/gstplaystream.lua 2017-10-09 20:55:55.000000000 +0200 @@ -32,7 +32,7 @@ end local play = Gst.ElementFactory.make('playbin', 'play') -play.uri = 'http://streamer-dtc-aa02.somafm.com:80/stream/1018' +play.uri = 'http://ice1.somafm.com/dronezone-128-mp3' --play.uri = 'http://www.cybertechmedia.com/samples/raycharles.mov' play.bus:add_watch(GLib.PRIORITY_DEFAULT, bus_callback) play.state = 'PLAYING' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/tests/Makefile new/lgi-0.9.2/tests/Makefile --- old/lgi-0.9.1/tests/Makefile 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/tests/Makefile 2017-10-09 20:55:55.000000000 +0200 @@ -57,9 +57,9 @@ check : all cd .. && LD_LIBRARY_PATH=tests:$$LD_LIBRARY_PATH \ GI_TYPELIB_PATH=tests:$$GI_TYPELIB_PATH \ - LUA_PATH=./?.lua\;`$(LUA) -e "print(package.path)"` \ - LUA_CPATH=./?.so\;`$(LUA) -e "print(package.cpath)"` \ - $(LUA) tests/test.lua + LUA_PATH="./?.lua;${LUA_PATH};" \ + LUA_CPATH="./?.so;${LUA_CPATH};" \ + $(shell command -v dbus-run-session || echo /usr/bin/dbus-launch) $(LUA) tests/test.lua $(REGRESS) : regress.o $(CC) $(ALL_LDFLAGS) -o $@ regress.o $(LIBS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/tests/dbus.lua new/lgi-0.9.2/tests/dbus.lua --- old/lgi-0.9.1/tests/dbus.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/tests/dbus.lua 2017-10-09 20:55:55.000000000 +0200 @@ -122,3 +122,19 @@ check(node.interfaces[1].properties[1].flags.READABLE) check(node.interfaces[1].properties[1].flags.WRITABLE) end + +function dbus.proxy_get_interface_info() + local Gio = lgi.Gio + + local interface = Gio.DBusInterfaceInfo { + name = 'SomeInterface' + } + local bus = Gio.bus_get_sync(Gio.BusType.SESSION) + local proxy, err = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, interface, "org.foo", "/", "org.foo.SomeInterface", nil) + assert(proxy, err) + + local interface2 = proxy:get_interface_info() + + -- Just so that we do test something + assert(interface == interface2) +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/tests/gio.lua new/lgi-0.9.2/tests/gio.lua --- old/lgi-0.9.1/tests/gio.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/tests/gio.lua 2017-10-09 20:55:55.000000000 +0200 @@ -8,6 +8,8 @@ --]]-------------------------------------------------------------------------- +local type = type + local lgi = require 'lgi' local core = require 'lgi.core' @@ -37,3 +39,49 @@ checkv(line, nil, "nil") checkv(length, 0, "number") end + +function gio.async_access() + -- Sometimes this hangs with LuaJIT when the JIT is on, no idea why. + -- FIXME: Figure out what is going on and fix this. + -- See also https://github.com/LuaJIT/LuaJIT/issues/340. + if jit then jit.off() end + + local Gio = lgi.Gio + local res + + res = Gio.DBusProxy.async_new + check(res ~= nil) + check(type(res) == 'function') + + res = Gio.DBusProxy.async_call + check(res ~= nil) + check(type(res) == 'function') + + res = Gio.async_bus_get + check(res ~= nil) + check(type(res) == 'function') + + local file = Gio.File.new_for_path('.') + res = Gio.Async.call(function(target) + return target:async_query_info('standard::size', + 'NONE') + end)(file) + check(res ~= nil) + + local b = Gio.Async.call(function() + return Gio.async_bus_get('SESSION') + end)() + check(Gio.DBusConnection:is_type_of(b)) + + local proxy = Gio.Async.call(function(bus) + return Gio.DBusProxy.async_new( + bus, 'NONE', nil, + 'org.freedesktop.DBus', + '/', + 'org.freedesktop.DBus') + end)(b) + check(Gio.DBusProxy:is_type_of(proxy)) + + if jit then jit.on() end +end + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lgi-0.9.1/tests/glib.lua new/lgi-0.9.2/tests/glib.lua --- old/lgi-0.9.1/tests/glib.lua 2016-05-27 21:56:36.000000000 +0200 +++ new/lgi-0.9.2/tests/glib.lua 2017-10-09 20:55:55.000000000 +0200 @@ -133,3 +133,24 @@ check(timeout == 42) check(called == source) end + +function glib.coroutine_related_crash() + -- This test does not have a specific assert() or check() call. Instead it + -- is a regression test: Once upon a time this caused a segmentation fault + -- due to a use-after-free. + + local glib = require("lgi").GLib + local mainloop = glib.MainLoop.new() + coroutine.wrap(function() + local co = coroutine.running() + for i=1,100 do + glib.timeout_add(glib.PRIORITY_DEFAULT, 0, function() + coroutine.resume(co) + return false + end) + coroutine.yield() + end + mainloop:quit() + end)() + mainloop:run() +end
