lua-users home
lua-l archive

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


Hi, 
my program runs Lua scripts from multiple threads. It looks like this:

1. 
In my host program:

...
lvm1 = lua_open()
...
lvm2 = lua_newthread()
...

2.
Start a separate OS-thread that does the following:
...

lua_getfield (main, LUA_GLOBALSINDEX, "main");			
int lua_err = lua_qpcall(lvm2, main, 0, 0, 0);                 
	if (lua_err)
	{
		script->FormatLuaErrMsg(lvm, lua_err);
		return lua_err;
	}
return 0;


Lua script code:

function main()
require "iuplua"
dlg = iup.dialog
{
  iup.vbox
  {
    iup.button{title="Button Very Long Text", size="50x"},
    iup.button{title="short", expand="HORIZONTAL"},
    iup.button{title="Mid Button", size="50x"}
  }
  ;title="IupDialog", font="Helvetica, Bold 14" 
}

-- Show the dialog and run the main loop
dlg:show()

if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
  iup.MainLoop()
end
iup.Close()
end
3.
When the thread is finished, the following occurs:
lua_close(lvm1) // lvm1 = lua_open()
and then an error ACCESS VIOLATION occurs. Error occurred while releasing
resources in Lua sources freeobj(L, curr);

Got any ideas?






--
View this message in context: http://lua.2524044.n2.nabble.com/lua-close-IUP-crash-tp7645673.html
Sent from the Lua-l mailing list archive at Nabble.com.