http://bugs.winehq.org/show_bug.cgi?id=8322
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |user32 Summary|TaskCoach failed to view |TaskCoach failed to view |Menu bar and right click |Menu bar and right click |menu |menu | |(user32.MENU_GetBitmapItemS | |ize handles | |HBMMENU_CALLBACK case | |incorrectly)
--- Comment #13 from Anastasius Focht focht@gmx.net 2011-05-03 19:09:23 CDT --- Hello,
confirming, still present.
$ wine --version wine-1.3.19-100-ga343c1f
$ sha1sum TaskCoach-0.67.0-win32.exe aef9abff5fc45abb9cb079831c1e2b5c6a1a93a4 TaskCoach-0.67.0-win32.exe
Trace log snippet:
--- snip --- ... 0025:Ret window proc 0xa015b0 (hwnd=0x2007c,msg=WM_INITMENUPOPUP,wp=000100f8,lp=00000007) retval=00000000 ... 0025:Call window proc 0xa015b0 (hwnd=0x2007c,msg=WM_DRAWITEM,wp=00000000,lp=0032ddb8) ... 0025:Call KERNEL32.OutputDebugStringW(01b01774 L"9:56:44 PM: ..\..\src\msw\ownerdrw.cpp(451): assert "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed in wxOwnerDrawn::OnDrawItem().\r\n") ret=00aaa771 0025:Ret KERNEL32.OutputDebugStringW() retval=0032d3b0 ret=00aaa771 --- snip ---
G00gling a bit, this thread came up:
http://wxpython-users.1045709.n5.nabble.com/C-assertion-in-PopupMenu-td23708...
--- quote --- "I just received an
automated error report I've never seen before and can't seem to reproduce on my system.
"
"I'm on WinXP Service Pack 3, while this user is only on Service Pack 2, so it still could be that your theory is correct if Microsoft fixed something under the hood." --- quote ---
Both developers - Paul McNett, author of the app and Robin Dunn, creator of wxPython - didn't notice its actually Wine the app was run on ;-)
-> "Platform: 0.9.27 Windows-XP-5.1.2600-SP2"
The source code of the corresponding member function wxOwnerDrawn::OnDrawItem(), where the assert appears:
http://trac.wxwidgets.org/browser/wxWidgets/branches/WX_2_8_BRANCH/src/msw/o...
From debugging it seems the selected bitmap is valid but the rectangle (const
wxRect& rc) passed into OnDrawItem() member function seems to be width=0, height=0, hence the assert().
--- snip --- Wine-dbg>bt Backtrace: =>0 0x68392bdb MENU_DrawBitmapItem(hdc=0x5e0, lpitem=0x160d50, rect=0x33e0bc, hmenu=0x4021c, hwndOwner=0x30236, odaction=0x1, menuBar=0) [/opt/projects/wine/wine-git/dlls/user32/menu.c:862] in user32 (0x0033e148) 1 0x68395866 MENU_DrawPopupMenu+0x293(hwnd=0x501a2, hdc=0x5e0, hmenu=0x4021c) [/opt/projects/wine/wine-git/dlls/user32/menu.c:1775] in user32 (0x0033e1b8) 2 0x68399e47 PopupMenuWndProc+0x188(hwnd=0x501a2, message=0xf, wParam=0, lParam=0) [/opt/projects/wine/wine-git/dlls/user32/menu.c:3493] in user32 (0x0033e258) ... Wine-dbg>n 867 int w = rect->right - rect->left; ... Wine-dbg>p *rect {left=0x2, top=0xb, right=0x2, bottom=0xb} ... Wine-dbg>frame 1 ... Wine-dbg>p bmprc {left=0x2, top=0xb, right=0x2, bottom=0xb} ... Wine-dbg>p *lpitem {fType=0, fState=0, wID=0x1391, hSubMenu=(nil), hCheckBit=(nil), hUnCheckBit=(nil), text="&Help contents", dwItemData=0x1a6d738, dwTypeData=0x0(nil), hbmpItem=0xffffffff, rect={left=0x3, top=0x3, right=0xaf, bottom=0x1a}, xTab=0xa6, bmpsize={cx=0, cy=0}} --- snip ---
I downloaded the sources and found the caller wxWindowMSW::MSWOnDrawItem() here:
http://trac.wxwidgets.org/browser/wxWidgets/branches/WX_2_8_BRANCH/src/msw/w...
It seems the bitmap rectangle calculation is tries to use a bmpsize (0,0) which results in empty rectangle. hbitmap == HBMMENU_CALLBACK -> MENU_GetBitmapItemSize -> WM_MEASUREITEM -> app returns cx = cy =0 because it doesn't handle WM_MEASUREITEM at all (defers to default winproc). The reason is this code:
http://trac.wxwidgets.org/browser/wxWidgets/branches/WX_2_8_BRANCH/src/msw/w...
(id -> wParam)
WM_MEASUREITEM Message MSDN doc:
http://msdn.microsoft.com/en-us/library/bb775925.aspx
--- quote --- wParam
Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lParam parameter. This value identifies the control that sent the WM_MEASUREITEM message. If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lParam is (UINT) –1, the message was sent by a combo edit field. --- quote ---
MENU_GetBitmapItemSize -> HBMMENU_CALLBACK -> WPARAM must be _zero_ for WM_MEASUREITEM. If you fix that the app works fine (displays menus).
Regards