[Top][All Lists]

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

[Libqtlua-list] Lingering QtLua::Functions after QtLua::State cleans the

From: David Palacio
Subject: [Libqtlua-list] Lingering QtLua::Functions after QtLua::State cleans the environment
Date: Wed, 19 Oct 2011 15:46:45 -0500
User-agent: Mutt/1.5.21 (2010-09-15)


I bind some C++ QtLua::Functions and some of them are referenced inside Lua
modules. These functions may throw an exception (Lua userdata is no
QtLua::UserData) if they are deleted when the State is being deleted. I
tracked the problem to a non existant metatable State::_key_item_metatable in
the registry. This check in fails:
    inline QtLua::Ref<UserData> UserData::get_ud_(lua_State *st, int i)
      if (lua_getmetatable(st, i))
          lua_pushlightuserdata(st, &State::_key_item_metatable);
          lua_rawget(st, LUA_REGISTRYINDEX);

          if (lua_rawequal(st, -2, -1))

The State::_key_item_metatable metatable is already deleted so this check

So, who deletes the metatable? QtLua::State does. May I know what for? Since
Lua should be able to take care of cleaning the environment and calling gc
methods when lua_close is called. I attach a patch that leaves the cleaning
responsability to lua_close.



Attachment: 0001-Let-the-Lua-VM-take-care-of-cleaning-the-environment.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]