lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I have found a possible bug in tolua++. When I'm using the addon lua script for creating virtual calls, it failed with the message below. It does work with 5.1.4 version but when I did add the latest patch, it does crash. And as far I can see it is one line in llex.c that is the problem. An extra line that calls the gc, also below. Perhaps the gc deletes the script?

Lua script for virtual calls:

Patch for lua:

I tried to mail but it failed.

***curr code for error is const _cstring      value(void);

stack traceback:
[string "tolua embedded: src/bin/lua/basic.lua"]:91: in function 'tolua_error'
      [string "tolua: embedded Lua code 23"]:5: in main chunk

** tolua internal error: [string "tolua embedded: src/bin/lua/function.lua"]:316: attempt to call global 'output_error_hook' (a nil value).

stack traceback:
      [string "tolua: embedded Lua code 23"]:6: in main chunk

--- llex.c    2007/12/27 13:02:25
+++ llex.c    2009/11/23 14:58:22
@@ -1,5 +1,5 @@
-** $Id: llex.c,v 2007/12/27 13:02:25 roberto Exp $
+** $Id: llex.c,v 2009/11/23 14:58:22 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
@@ -118,8 +118,10 @@
 lua_State *L = ls->L;
 TString *ts = luaS_newlstr(L, str, l);
 TValue *o = luaH_setstr(L, ls->fs->h, ts);  /* entry for `str' */
-  if (ttisnil(o))
+  if (ttisnil(o)) {
   setbvalue(o, 1);  /* make sure `str' will not be collected */
+    luaC_checkGC(L);
+  }
 return ts;