aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-05-22 11:50:48 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-05-22 11:50:48 +0200
commit5c2ba124ba8706f9e9a877c78e78b21c6d2874d5 (patch)
tree543aaeeea56e921204e8c64f66c9c449a6da4a4c /vis-lua.c
parent6a7f12527b1d5f562c8e762126719706329aae8b (diff)
downloadvis-5c2ba124ba8706f9e9a877c78e78b21c6d2874d5.tar.gz
vis-5c2ba124ba8706f9e9a877c78e78b21c6d2874d5.tar.xz
vis-lua: do not report errors recursively
Displaying an error might create a new window which in turn can trigger new events (all other windows are resized+redrawn) which might again cause errors. There is still no sane way to exit the editor in this case, but at least the error messages should be readable.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vis-lua.c b/vis-lua.c
index fdc4fd2..eb54576 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -135,12 +135,16 @@ static void stack_dump(lua_State *L, const char *format, ...) {
static int error_function(lua_State *L) {
Vis *vis = lua_touserdata(L, lua_upvalueindex(1));
+ if (vis->errorhandler)
+ return 1;
+ vis->errorhandler = true;
size_t len;
const char *msg = lua_tostring(L, 1);
if (msg)
luaL_traceback(L, L, msg, 1);
msg = lua_tolstring(L, 1, &len);
vis_message_show(vis, msg);
+ vis->errorhandler = false;
return 1;
}