diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-07-26 20:00:27 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-07-26 20:00:27 +0000 |
commit | 43d8ad9bdc1dcd17753ce3537544feb157bf3888 (patch) | |
tree | 20dc26239f9bc9eeec772c52c7512b7ba875d8c0 /plugins/MirLua | |
parent | 04bad7d78b1b7eaba07cfc58d6cfffc876f774ce (diff) |
MirLua: there is no reason to store whole TTBButton struct
git-svn-id: http://svn.miranda-ng.org/main/trunk@14731 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-rw-r--r-- | plugins/MirLua/src/m_toptoolbar.cpp | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/plugins/MirLua/src/m_toptoolbar.cpp b/plugins/MirLua/src/m_toptoolbar.cpp index fcc5208bef..be1739bfcc 100644 --- a/plugins/MirLua/src/m_toptoolbar.cpp +++ b/plugins/MirLua/src/m_toptoolbar.cpp @@ -1,26 +1,14 @@ #include "stdafx.h"
-struct HandleTBBParam
-{
- HANDLE h;
- TTBButton* tbb;
- HandleTBBParam(HANDLE h, TTBButton* tbb) : h(h), tbb(tbb) { }
-};
-
-static LIST<void> TBButtons(1, HandleKeySortT);
+static LIST<void> TBButtons(1, PtrKeySortT);
void KillModuleTTBButton()
{
while (TBButtons.getCount())
{
- HandleTBBParam* param = (HandleTBBParam*)TBButtons[0];
- ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)param->h, 0);
+ HANDLE hTTButton = TBButtons[0];
+ ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
TBButtons.remove(0);
- mir_free(param->tbb->name);
- mir_free(param->tbb->pszTooltipUp);
- mir_free(param->tbb->pszTooltipDn);
- mir_free(param->tbb);
- delete param;
}
}
@@ -106,14 +94,12 @@ static int lua_AddButton(lua_State *L) lua_pushlightuserdata(L, res);
if (res != INVALID_HANDLE_VALUE)
- TBButtons.insert(new HandleTBBParam(res, tbb));
- else
- {
- mir_free(tbb->name);
- mir_free(tbb->pszTooltipUp);
- mir_free(tbb->pszTooltipDn);
- mir_free(tbb);
- }
+ TBButtons.insert(res);
+
+ mir_free(tbb->name);
+ mir_free(tbb->pszTooltipUp);
+ mir_free(tbb->pszTooltipDn);
+ mir_free(tbb);
return 1;
}
@@ -126,18 +112,7 @@ static int lua_RemoveButton(lua_State *L) lua_pushinteger(L, res);
if (!res)
- {
- HandleTBBParam* param = (HandleTBBParam*)TBButtons.find(&hTTButton);
- if (param)
- {
- TBButtons.remove(param);
- mir_free(param->tbb->name);
- mir_free(param->tbb->pszTooltipUp);
- mir_free(param->tbb->pszTooltipDn);
- mir_free(param->tbb);
- delete param;
- }
- }
+ TBButtons.remove(hTTButton);
return 1;
}
|