DestroyMenu doesn't remove the link between window and menu under some conditions...

Marco Pietrobono pietrobo at pietrobo.com
Mon Apr 7 05:48:37 CDT 2003


  Hi.

  I'm investigating the patches someone has provided to allow the use of
the NevewinterNight Aurora Toolset under linux. I'm trying to find the
correct way to fix the known issues.

  This one is related to the way Aurora creates the menubar. It seems
that it does the following sequence:

// first it creates all the menus for the taskbar (and it fills them)
trace:menu:CreateMenu return 0x2e4
trace:menu:CreateMenu return 0x320
trace:menu:CreateMenu return 0x35c
trace:menu:CreateMenu return 0x398
trace:menu:CreateMenu return 0x3d4
trace:menu:CreateMenu return 0x410
trace:menu:CreateMenu return 0x44c
trace:menu:CreateMenu return 0x488

// then it checks to see if the window already has a menu
trace:menu:GetMenu for 0x30025 returning (nil)

// and then it links the menu to the window
trace:menu:SetMenu (0x30025, 0x2e4);

// after a while, it destroys the menu
trace:menu:DestroyMenu (0x2e4)

// creates a new menu which will get the same handle as the old one
trace:menu:CreateMenu return 0x2e4

// but it does not link the new menu back to the window,
// so the new menu has a null hWnd
trace:menu:GetMenu for 0x30025 returning 0x2e4
trace:menu:GetMenu pmenu 0x30025 connected to hWnd 0x2e4 has null hWnd

  (the last one is a message I added while investigating the problem)

  It seems that the problem lies in the DestroyMenu. Its codepath for
the not null hWnd handle contemplates only the case of a window that
should be destroyed along with the menu itself. It seems that if the
hWnd is not null and the window will survive the destruction of the
menu, it should forget the handle of the destroyed menu.

  the proposed fix seems to work correctly, and now the Aurora menu is
working. I think it should be safe to use.

  later,

/pietrobo


License: LGPL, X11
Changelog:
         Marco Pietrobono <pietrobo at pietrobo.com>
         - force the window linked to a popup menu to forget about the
           menu when the menu is destroyed.

-- 
Stud. Marco Pietrobono            | Murphy's Law: if something could
v. del Calice, 39 - 00178 ROMA    |     go wrong, it does.
Tel. +39.06.7186329  339.7410893  | Legge di Murphy: se qualcosa pu?
http://www.pietrobo.com           |    andar male, lo far?.
------------------------------------------------------------------------
A strange game.
The only winning move is
not to play.
What about a nice play of chess ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unlink_system_menu.diff
Type: text/x-patch
Size: 852 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20030407/3527c298/unlink_system_menu.bin


More information about the wine-patches mailing list