diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-12 20:27:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-12 20:27:14 +0000 |
commit | 695540757785bb95fd20c68fc784dec8daba146c (patch) | |
tree | a11039a3de59ec06862a8e0dfcf1bc8e33e52a98 | |
parent | bb0fa93f4a6425e5d78a8d1388f35edc152744a8 (diff) |
fix for toolbar window freezing
git-svn-id: http://svn.miranda-ng.org/main/trunk@933 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 976774acd9..cdb4b04883 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -220,12 +220,16 @@ int ArrangeButtons() int nLineCount = 0;
int i, ypos = 1, xpos = g_ctrl->nButtonSpace, nextX = 0, y = 0;
- int newheight = g_ctrl->nButtonHeight+1;
+ int newheight = g_ctrl->nButtonHeight+1, nButtonCount=0;
- if (Buttons.getCount() == 0)
+ for (i=0; i < Buttons.getCount(); i++)
+ if (Buttons[i]->hwnd)
+ nButtonCount++;
+
+ if (nButtonCount == 0)
return 0;
- HDWP hdwp = BeginDeferWindowPos(Buttons.getCount());
+ HDWP hdwp = BeginDeferWindowPos(nButtonCount);
bool bWasButttonBefore;
int nUsedWidth, iFirstButtonId = 0, iLastButtonId = 0;
@@ -238,6 +242,8 @@ int ArrangeButtons() for (i=iFirstButtonId; i < Buttons.getCount(); i++) {
TopButtonInt *b = Buttons[i];
+ if (b->hwnd == NULL)
+ continue;
int width = 0;
if ( b->isVisible())
@@ -254,6 +260,8 @@ int ArrangeButtons() for (i=iFirstButtonId; i < iLastButtonId; i++) {
TopButtonInt *b = Buttons[i];
+ if (b->hwnd == NULL)
+ continue;
bool bOldVisible = IsWindowVisible(b->hwnd) != 0;
if (bOldVisible != b->isVisible())
@@ -307,8 +315,10 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) b->hLangpack = (int)lParam;
b->LoadSettings();
b->CreateWnd();
- if (b->hwnd == NULL)
+ if (b->hwnd == NULL) {
+ delete b;
return -1;
+ }
{
mir_cslock lck(csButtonsHook);
Buttons.insert(b);
|