summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src/CLCButton.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-06-10 14:01:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-06-10 14:01:23 +0000
commit075c7d0030e543e59adceae9e73c73cbb661482f (patch)
tree18202915fd2280481b60dfa046428966003c0554 /plugins/Clist_nicer/src/CLCButton.cpp
parentf8dd614b31290bc8b314314581a38503ac43140d (diff)
fix for crash in clist_nicer on startup
git-svn-id: http://svn.miranda-ng.org/main/trunk@9432 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer/src/CLCButton.cpp')
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp35
1 files changed, 4 insertions, 31 deletions
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index c337a226e9..5cbf3fd6d6 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -43,29 +43,6 @@ struct CluiTopButton BTNS[] =
static int g_index = -1;
-static int getButtonIndex(HANDLE hButton)
-{
- // nasty clutch. during the initial customization
- // hButton isn't assigned into BNTS yet
- if (g_index != -1)
- return g_index;
-
- for (int i = 0; i < SIZEOF(BTNS); i++)
- if (BTNS[i].hButton == hButton)
- return i;
-
- return -1;
-}
-
-static int getLastIndex()
-{
- for (int i = 0; ; i++)
- if (BTNS[i].pszButtonID == NULL)
- return i;
-
- return -1;
-}
-
static void InitDefaultButtons()
{
for (int i = 0; i < SIZEOF(BTNS); i++ ) {
@@ -597,18 +574,14 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM)
mir_subclassWindow(hWnd, TSButtonWndProc);
MButtonExtension *bct = (MButtonExtension*)GetWindowLongPtr(hWnd, 0);
- int idx = getButtonIndex(hButton);
- if (idx != -1) { // adding built-in button
- BTNS[idx].hwndButton = hWnd;
- if (BTNS[idx].isAction)
+ if (g_index != -1) { // adding built-in button
+ BTNS[g_index].hwndButton = hWnd;
+ if (BTNS[g_index].isAction)
bct->bSendOnDown = true;
- if (!BTNS[idx].isPush)
+ if (!BTNS[g_index].isPush)
bct->bIsPushBtn = true;
}
else {
- idx = getLastIndex();
- BTNS[idx].hwndButton = hWnd;
- BTNS[idx].pszButtonID = "plugin";
bool bSkinned = cfg::dat.bSkinnedButtonMode != 0;
CustomizeButton(hWnd, bSkinned, !bSkinned, bSkinned, true);
}