mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
MeasureScript: Fixed memory leak when DynamicVariables=1.
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
#include "lua_rainmeter_ext.h"
|
||||
|
||||
bool LuaManager::m_bInitialized = false;
|
||||
int LuaManager::m_RefCount = 0;
|
||||
lua_State* LuaManager::m_pState = 0;
|
||||
|
||||
void LuaManager::Init()
|
||||
@ -35,11 +35,22 @@ void LuaManager::Init()
|
||||
|
||||
luaopen_rainmeter_ext(m_pState);
|
||||
}
|
||||
|
||||
++m_RefCount;
|
||||
}
|
||||
|
||||
void LuaManager::CleanUp()
|
||||
{
|
||||
lua_close(m_pState);
|
||||
if (m_RefCount > 0)
|
||||
{
|
||||
--m_RefCount;
|
||||
}
|
||||
|
||||
if (m_RefCount == 0 && m_pState != 0)
|
||||
{
|
||||
lua_close(m_pState);
|
||||
m_pState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LuaManager::ReportErrors(lua_State * L)
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
static bool m_bInitialized;
|
||||
static int m_RefCount;
|
||||
|
||||
static lua_State* m_pState;
|
||||
};
|
||||
|
Reference in New Issue
Block a user