summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-30 08:09:44 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-30 08:09:44 +0000
commit9c8b58a6166b681c587f59358b04efcd569b11db (patch)
tree30373fda7efaf73b89339029372bd19efa087512 /plugins
parent580c7f7fbcb7e9365fcbed87fc751e8e9d155cc2 (diff)
MirLua: fixed some memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@14449 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp3
-rw-r--r--plugins/MirLua/src/m_msg_buttonsbar.cpp18
-rw-r--r--plugins/MirLua/src/m_popup.cpp7
3 files changed, 21 insertions, 7 deletions
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index 7b8df35cd0..76b54649e9 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -96,6 +96,9 @@ static int lua_ModifyMenuItem(lua_State *L)
HANDLE hIcolibItem = lua_touserdata(L, 3);
int flags = lua_tointeger(L, 4);
+ if (!(flags & CMIF_UNICODE))
+ flags |= CMIF_UNICODE;
+
INT_PTR res = ::Menu_ModifyItem(hMenuItem, name, hIcolibItem, flags);
lua_pushinteger(L, res);
return 1;
diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp
index a9b1f6756f..6bfc73550c 100644
--- a/plugins/MirLua/src/m_msg_buttonsbar.cpp
+++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp
@@ -21,12 +21,12 @@ static BBButton* MakeBBButton(lua_State *L)
tbb->bbbFlags = lua_tointeger(L, -1);
lua_pop(L, 1);
+ if ((tbb->bbbFlags & BBBF_ANSITOOLTIP))
+ tbb->bbbFlags &= ~BBBF_ANSITOOLTIP;
+
lua_pushstring(L, "Tooltip");
lua_gettable(L, -2);
- if ((tbb->bbbFlags & BBBF_ANSITOOLTIP))
- tbb->pszTooltip = mir_utf8decode((char*)lua_tostring(L, -1), NULL);
- else
- tbb->ptszTooltip = mir_utf8decodeT((char*)lua_tostring(L, -1));
+ tbb->ptszTooltip = mir_utf8decodeT((char*)lua_tostring(L, -1));
lua_pop(L, 1);
lua_pushstring(L, "Icon");
@@ -50,6 +50,9 @@ static int lua_AddButton(lua_State *L)
INT_PTR res = ::CallService(MS_BB_ADDBUTTON, 0, (LPARAM)bbb);
lua_pushinteger(L, res);
+ mir_free(bbb->pszModuleName);
+ mir_free(bbb->ptszTooltip);
+
return 1;
}
@@ -66,6 +69,9 @@ static int lua_ModifyButton(lua_State *L)
INT_PTR res = ::CallService(MS_BB_MODIFYBUTTON, 0, (LPARAM)bbb);
lua_pushinteger(L, res);
+ mir_free(bbb->pszModuleName);
+ mir_free(bbb->ptszTooltip);
+
return 1;
}
@@ -78,6 +84,8 @@ static int lua_RemoveButton(lua_State *L)
INT_PTR res = ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbb);
lua_pushinteger(L, res);
+ mir_free(bbb.pszModuleName);
+
return 1;
}
@@ -111,7 +119,7 @@ int ButtonPressedHookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPAR
lua_newtable(L);
lua_pushstring(L, "Module");
- lua_pushstring(L, bcd->pszModule);
+ lua_pushstring(L, ptrA(mir_utf8encode(bcd->pszModule)));
lua_settable(L, -3);
lua_pushstring(L, "ButtonID");
lua_pushinteger(L, bcd->dwButtonId);
diff --git a/plugins/MirLua/src/m_popup.cpp b/plugins/MirLua/src/m_popup.cpp
index f76a90b91a..c064d34ef3 100644
--- a/plugins/MirLua/src/m_popup.cpp
+++ b/plugins/MirLua/src/m_popup.cpp
@@ -15,12 +15,12 @@ static POPUPDATA2* MakePopupData(lua_State *L)
lua_pushstring(L, "Title");
lua_gettable(L, -2);
- ppd->lptzTitle = mir_utf8decodeT((char*)lua_tostring(L, -1));
+ ppd->lptzTitle = mir_utf8decodeT(lua_tostring(L, -1));
lua_pop(L, 1);
lua_pushstring(L, "Text");
lua_gettable(L, -2);
- ppd->lptzText = mir_utf8decodeT((char*)luaL_checkstring(L, -1));
+ ppd->lptzText = mir_utf8decodeT(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_pushstring(L, "hContact");
@@ -59,6 +59,9 @@ static int lua_AddPoput(lua_State *L)
INT_PTR res = ::CallService(MS_POPUP_ADDPOPUP2, (WPARAM)ppd, 0);
lua_pushinteger(L, res);
+ mir_free(ppd->lptzTitle);
+ mir_free(ppd->lptzText);
+
return 1;
}