summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2016-06-24 17:43:57 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2016-06-24 17:43:57 +0000
commitee37779cc2bdb12315b962af3df2501fdcc68089 (patch)
treeacffa7bb1c61394af0deadc7382a3780af0263ad /plugins/MirLua/src/mlua.cpp
parent1664b4b774a97119c71a334916778d8ee2883fba (diff)
temporary revert
git-svn-id: http://svn.miranda-ng.org/main/trunk@17032 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua.cpp')
-rw-r--r--plugins/MirLua/src/mlua.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp
index bea7645bbf..2c67f32f3e 100644
--- a/plugins/MirLua/src/mlua.cpp
+++ b/plugins/MirLua/src/mlua.cpp
@@ -2,6 +2,9 @@
int hMLuaLangpack;
+LIST<void> CMLua::HookRefs(1, HandleKeySortT);
+LIST<void> CMLua::ServiceRefs(1, HandleKeySortT);
+
static int CompareScripts(const CMLuaScript* p1, const CMLuaScript* p2)
{
return mir_strcmpi(p1->GetModuleName(), p2->GetModuleName());
@@ -80,7 +83,7 @@ void CMLua::Unload()
{
CMLuaScript *script = g_mLua->Scripts[last - 1];
Scripts.remove(script);
- script->Unload(L);
+ script->Unload();
delete script;
}
@@ -89,8 +92,33 @@ void CMLua::Unload()
KillModuleMenus(hMLuaLangpack);
KillModuleHotkeys(hMLuaLangpack);
- KillObjectEventHooks(this);
- KillObjectServices(this);
+ KillObjectEventHooks(L);
+ KillObjectServices(L);
lua_close(L);
}
+
+void CMLua::KillLuaRefs()
+{
+ while (HookRefs.getCount())
+ {
+ HandleRefParam *param = (HandleRefParam*)HookRefs[0];
+ if (param != NULL)
+ {
+ luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
+ HookRefs.remove(0);
+ delete param;
+ }
+ }
+
+ while (ServiceRefs.getCount())
+ {
+ HandleRefParam *param = (HandleRefParam*)ServiceRefs[0];
+ if (param != NULL)
+ {
+ luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref);
+ ServiceRefs.remove(0);
+ delete param;
+ }
+ }
+}