From 18fb3de745211092ba2380744e8f67f958076939 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Tue, 28 Oct 2014 14:48:34 +0200 Subject: [PATCH] lua-timer: explicitly restore Lua stack across callbacks. --- src/core/lua-bindings/lua-timer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/lua-bindings/lua-timer.c b/src/core/lua-bindings/lua-timer.c index 0fa5b4d..eb87494 100644 --- a/src/core/lua-bindings/lua-timer.c +++ b/src/core/lua-bindings/lua-timer.c @@ -107,9 +107,12 @@ static void timer_lua_cb(mrp_timer_t *timer, void *user_data) { timer_lua_t *t = (timer_lua_t *)user_data; int one = t->oneshot; + int top; MRP_UNUSED(timer); + top = lua_gettop(t->L); + if (mrp_lua_object_deref_value(t, t->L, t->callback, false)) { mrp_lua_push_object(t->L, t); @@ -124,6 +127,8 @@ static void timer_lua_cb(mrp_timer_t *timer, void *user_data) mrp_del_timer(t->t); t->t = NULL; } + + lua_settop(t->L, top); } -- 2.7.4