From 5c446c9c09ef7f6c30de6a330e4cc652f2d5f024 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 1 Aug 2015 18:23:52 +0200 Subject: [PATCH 1/2] luaA_dofunction_on_error: call luaL_tolstring on error This prevents a follow-up error through lua_concat, in case the error is not a string. Ref: https://github.com/awesomeWM/awesome/issues/301 --- luaa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/luaa.c b/luaa.c index 7629b51ca..42e5f95bd 100644 --- a/luaa.c +++ b/luaa.c @@ -323,6 +323,10 @@ luaA_panic(lua_State *L) static int luaA_dofunction_on_error(lua_State *L) { +#if LUA_VERSION_NUM >= 502 + /* Convert error to string, to prevent a follow-up error with lua_concat. */ + luaL_tolstring(L, -1, NULL); +#endif /* duplicate string error */ lua_pushvalue(L, -1); /* emit error signal */ From 5b60bc212a0d4105931f3de193d8d69ef8153ae7 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 1 Aug 2015 18:25:10 +0200 Subject: [PATCH 2/2] textbox.set_markup: handle `parsed.message` from Pango.parse_markup Ref: https://github.com/pavouk/lgi/issues/115 Fixes: https://github.com/awesomeWM/awesome/issues/301 --- lib/wibox/widget/textbox.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wibox/widget/textbox.lua b/lib/wibox/widget/textbox.lua index c8096c533..007ed0c8d 100644 --- a/lib/wibox/widget/textbox.lua +++ b/lib/wibox/widget/textbox.lua @@ -63,8 +63,8 @@ function textbox:set_markup(text) end local attr, parsed = Pango.parse_markup(text, -1, 0) - -- In case of error, attr is false and parsed is an error message - if not attr then error(parsed) end + -- In case of error, attr is false and parsed is a GLib.Error instance. + if not attr then error(parsed.message or tostring(parsed)) end self._markup = text self._layout.text = parsed