1
0

LuaWindow: Fixed memory leaks with unclosed windows

A player disconnecting will now force all windows to close, not respecting any plugin's overrides.
http://forum.mc-server.org/showthread.php?tid=1146&pid=8350#pid8350

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1543 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-06-02 21:59:25 +00:00
parent d2b3011c05
commit 8ff22344af
9 changed files with 22 additions and 21 deletions

View File

@@ -1665,7 +1665,7 @@ void cPlugin_NewLua::Unreference(int a_LuaRef)
bool cPlugin_NewLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player)
bool cPlugin_NewLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse)
{
ASSERT(a_FnRef != LUA_REFNIL);
@@ -1673,9 +1673,10 @@ bool cPlugin_NewLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPla
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // Push the function to be called
tolua_pushusertype(m_LuaState, &a_Window, "cWindow");
tolua_pushusertype(m_LuaState, &a_Player, "cPlayer");
tolua_pushboolean (m_LuaState, a_CanRefuse ? 1 : 0);
// Call function:
int s = lua_pcall(m_LuaState, 2, 1, 0);
int s = lua_pcall(m_LuaState, 3, 1, 0);
if (report_errors(m_LuaState, s))
{
LOGERROR("LUA error in %s. Stack size: %i", __FUNCTION__, lua_gettop(m_LuaState));