comctl32/toolbar: Move initialization to WM_NCREATE handler
Nikolay Sivov
bunglehead at gmail.com
Fri Jun 26 04:44:34 CDT 2009
http://bugs.winehq.org/show_bug.cgi?id=18688
For anyone interested: application from this bug started after some
3d application crashes in winex11.drv/opengl code.
The problem is that we initialize toolbar internal data to late which
cause using zero value window handle in some api calls.
I know nothing about GL related stuff, but somebody could find this
usefull I think (crash log is available in this report).
Changelog:
- Move initialization to WM_NCREATE handler
>From bc32f156e2ceecaac0db5ca076cd3ef7fb93a1db Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 26 Jun 2009 13:37:55 +0400
Subject: Move initialization to WM_NCREATE handler
---
dlls/comctl32/toolbar.c | 66 ++++++++++++++++++++++++----------------------
1 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 9bbac21..cd279f9 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -5237,38 +5237,7 @@ TOOLBAR_Create (HWND hwnd, LPARAM lParam)
TRACE("hwnd = %p\n", hwnd);
- /* initialize info structure */
- infoPtr->nButtonWidth = 23;
- infoPtr->nButtonHeight = 22;
- infoPtr->nBitmapHeight = 16;
- infoPtr->nBitmapWidth = 16;
-
- infoPtr->nMaxTextRows = 1;
- infoPtr->cxMin = -1;
- infoPtr->cxMax = -1;
- infoPtr->nNumBitmaps = 0;
- infoPtr->nNumStrings = 0;
-
- infoPtr->bCaptured = FALSE;
- infoPtr->nButtonDown = -1;
- infoPtr->nButtonDrag = -1;
- infoPtr->nOldHit = -1;
- infoPtr->nHotItem = -1;
- infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
- infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
- infoPtr->bAnchor = FALSE; /* no anchor highlighting */
- infoPtr->bDragOutSent = FALSE;
- infoPtr->iVersion = 0;
- infoPtr->hwndSelf = hwnd;
- infoPtr->bDoRedraw = TRUE;
- infoPtr->clrBtnHighlight = CLR_DEFAULT;
- infoPtr->clrBtnShadow = CLR_DEFAULT;
- infoPtr->szPadding.cx = DEFPAD_CX;
- infoPtr->szPadding.cy = DEFPAD_CY;
- infoPtr->iListGap = DEFLISTGAP;
- infoPtr->iTopMargin = default_top_margin(infoPtr);
infoPtr->dwStyle = dwStyle;
- infoPtr->tbim.iButton = -1;
GetClientRect(hwnd, &infoPtr->client_rect);
infoPtr->bUnicode = infoPtr->hwndNotify &&
(NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY));
@@ -6002,7 +5971,7 @@ static LRESULT
TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr;
- LPCREATESTRUCTA cs = (LPCREATESTRUCTA)lParam;
+ LPCREATESTRUCTW cs = (LPCREATESTRUCTW)lParam;
DWORD styleadd = 0;
/* allocate memory for info structure */
@@ -6014,6 +5983,39 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nRows = 1;
infoPtr->nWidth = 0;
+ /* initialize info structure */
+ infoPtr->nButtonWidth = 23;
+ infoPtr->nButtonHeight = 22;
+ infoPtr->nBitmapHeight = 16;
+ infoPtr->nBitmapWidth = 16;
+
+ infoPtr->nMaxTextRows = 1;
+ infoPtr->cxMin = -1;
+ infoPtr->cxMax = -1;
+ infoPtr->nNumBitmaps = 0;
+ infoPtr->nNumStrings = 0;
+
+ infoPtr->bCaptured = FALSE;
+ infoPtr->nButtonDown = -1;
+ infoPtr->nButtonDrag = -1;
+ infoPtr->nOldHit = -1;
+ infoPtr->nHotItem = -1;
+ infoPtr->hwndNotify = cs->hwndParent;
+ infoPtr->dwDTFlags = (cs->style & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
+ infoPtr->bAnchor = FALSE; /* no anchor highlighting */
+ infoPtr->bDragOutSent = FALSE;
+ infoPtr->iVersion = 0;
+ infoPtr->hwndSelf = hwnd;
+ infoPtr->bDoRedraw = TRUE;
+ infoPtr->clrBtnHighlight = CLR_DEFAULT;
+ infoPtr->clrBtnShadow = CLR_DEFAULT;
+ infoPtr->szPadding.cx = DEFPAD_CX;
+ infoPtr->szPadding.cy = DEFPAD_CY;
+ infoPtr->iListGap = DEFLISTGAP;
+ infoPtr->iTopMargin = default_top_margin(infoPtr);
+ infoPtr->dwStyle = cs->style;
+ infoPtr->tbim.iButton = -1;
+
/* fix instance handle, if the toolbar was created by CreateToolbarEx() */
if (!GetWindowLongPtrW (hwnd, GWLP_HINSTANCE)) {
HINSTANCE hInst = (HINSTANCE)GetWindowLongPtrW (GetParent (hwnd), GWLP_HINSTANCE);
--
1.5.6.5
More information about the wine-patches
mailing list