summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/TopToolBar/toolbar.cpp26
-rw-r--r--plugins/TopToolBar/toolbarwnd.cpp3
2 files changed, 13 insertions, 16 deletions
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp
index bbb4ee5932..976774acd9 100644
--- a/plugins/TopToolBar/toolbar.cpp
+++ b/plugins/TopToolBar/toolbar.cpp
@@ -296,22 +296,22 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam)
if (wParam == 0)
return -1;
- TopButtonInt* b;
- {
- mir_cslock lck(csButtonsHook);
-
- TTBButton *but = (TTBButton*)wParam;
- if (but->cbSize != sizeof(TTBButton) && but->cbSize != OLD_TBBUTTON_SIZE)
- return -1;
+ TTBButton *but = (TTBButton*)wParam;
+ if (but->cbSize != sizeof(TTBButton) && but->cbSize != OLD_TBBUTTON_SIZE)
+ return -1;
- if ( !(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))
- return -1;
+ if ( !(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))
+ return -1;
- b = CreateButton(but);
- b->hLangpack = (int)lParam;
- b->LoadSettings();
+ TopButtonInt* b = CreateButton(but);
+ b->hLangpack = (int)lParam;
+ b->LoadSettings();
+ b->CreateWnd();
+ if (b->hwnd == NULL)
+ return -1;
+ {
+ mir_cslock lck(csButtonsHook);
Buttons.insert(b);
- b->CreateWnd();
}
g_ctrl->bOrderChanged = TRUE;
diff --git a/plugins/TopToolBar/toolbarwnd.cpp b/plugins/TopToolBar/toolbarwnd.cpp
index 4795810f19..d082464b4f 100644
--- a/plugins/TopToolBar/toolbarwnd.cpp
+++ b/plugins/TopToolBar/toolbarwnd.cpp
@@ -275,9 +275,6 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam)
0, 0, 0, g_ctrl->nLastHeight, parent, NULL, hInst, NULL);
SetWindowLongPtr(g_ctrl->hWnd, 0, (LPARAM)g_ctrl);
- for (int i=0; i < Buttons.getCount(); i++)
- Buttons[i]->CreateWnd();
-
LoadBackgroundOptions();
// if we're working in skinned clist, receive the standard buttons & customizations