Check that the Lua stack is empty in the main loop
The Lua stack is a finite resource and everything that pushes something there should also clean up. This is not a problem for functions that are called by Lua, because their "stack frame" is freed when they return. However, in global context, Lua does not and cannot automatically clean up for us. Thus, it makes sense to print a warning in this case. (Additionally, this cleans up the stack if something is left) Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
9d34f2dc03
commit
bf73f78eea
|
@ -285,6 +285,13 @@ a_glib_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|||
/* Do all deferred work now */
|
||||
awesome_refresh();
|
||||
|
||||
/* Check if the Lua stack is the way it should be */
|
||||
if (lua_gettop(globalconf.L) != 0) {
|
||||
warn("Something was left on the Lua stack, this is a bug!");
|
||||
luaA_dumpstack(globalconf.L);
|
||||
lua_settop(globalconf.L, 0);
|
||||
}
|
||||
|
||||
/* Check how long this main loop iteration took */
|
||||
gettimeofday(&now, NULL);
|
||||
timersub(&now, &last_wakeup, &length_time);
|
||||
|
|
Loading…
Reference in New Issue