Skip to content

Commit

Permalink
(lua) don't try to dump stack-index 0, always provide L to monitor
Browse files Browse the repository at this point in the history
FossilOrigin-Name: af189a7e576f8a6b1c920fe8f6af06a7681bb10add9f47dd8244e058894e02a9
  • Loading branch information
void committed Jan 31, 2025
1 parent 16e2bf6 commit e5b35b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engine/alt/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void alt_trace_dumptable_raw(lua_State* L, int ofs, int cap, FILE* out)
void alt_trace_dumpstack_raw(lua_State* L, FILE* out)
{
int top = lua_gettop(L);
while (top >= 0){
while (top > 0){
fprintf(out, "type=stack:index=%d:name=%d:var", top, top);
alt_trace_print_type(L, top, "\n", out);
top--;
Expand Down
4 changes: 3 additions & 1 deletion src/engine/arcan_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ void arcan_monitor_finish(bool ok)
arcan_monitor_watchdog(NULL, NULL);
}

extern struct arcan_luactx* main_lua_context;
void arcan_monitor_tick(int n)
{
static size_t count;
Expand All @@ -988,7 +989,8 @@ void arcan_monitor_tick(int n)
.events = POLLIN
};
if (1 == poll(&pfd, 1, 0)){
arcan_monitor_watchdog(NULL, NULL);
arcan_monitor_watchdog(
(lua_State*)main_lua_context, NULL);
}
}

Expand Down

0 comments on commit e5b35b2

Please sign in to comment.