aboutsummaryrefslogtreecommitdiff
path: root/src/lj_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_state.c')
-rw-r--r--src/lj_state.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lj_state.c b/src/lj_state.c
index f11467fe..8fd11b2f 100644
--- a/src/lj_state.c
+++ b/src/lj_state.c
@@ -27,6 +27,7 @@
27#include "lj_vm.h" 27#include "lj_vm.h"
28#include "lj_lex.h" 28#include "lj_lex.h"
29#include "lj_alloc.h" 29#include "lj_alloc.h"
30#include "luajit.h"
30 31
31/* -- Stack handling ------------------------------------------------------ */ 32/* -- Stack handling ------------------------------------------------------ */
32 33
@@ -237,8 +238,11 @@ LUA_API void lua_close(lua_State *L)
237{ 238{
238 global_State *g = G(L); 239 global_State *g = G(L);
239 int i; 240 int i;
240 setgcrefnull(g->cur_L);
241 L = mainthread(g); /* Only the main thread can be closed. */ 241 L = mainthread(g); /* Only the main thread can be closed. */
242#if LJ_HASPROFILE
243 luaJIT_profile_stop(L);
244#endif
245 setgcrefnull(g->cur_L);
242 lj_func_closeuv(L, tvref(L->stack)); 246 lj_func_closeuv(L, tvref(L->stack));
243 lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */ 247 lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */
244#if LJ_HASJIT 248#if LJ_HASJIT