Menu - loop of sending and receiving WM_TIMER
Jose Alonso
alonso at estadao.com.br
Fri Apr 15 14:07:47 CDT 2005
On Thu, 2005-04-14 at 20:44 +0200, Alexandre Julliard wrote:
>
> The WM_TIMER cannot "remain in the queue", it's never put there in the
> first place, it's generated on the fly. If you really see a WM_TIMER
> in the posted message queue, it's because someone has done a
> PostMessage on it, and that would definitely be a bug. I doubt it's
> the problem you are seeing though.
>
Ok. I made a wrong assumption.
Continuing to investigate the problem, I found that:
DispatchMessageW (2) is calling TimerProc and TimerProc
is posting a WM_TIMER message.
I am attaching a small program to reproduce this.
If you click 'File' then happens the loop I mentioned.
I think one possible solution to avoid this case is
the attached patch. (I think it's safe to remove
unconditionally a message that will be dispatched).
alonso
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 2509 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050415/92951e21/main.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 9953 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050415/92951e21/Makefile.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: res.h
Type: text/x-chdr
Size: 121 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050415/92951e21/res.h
-------------- next part --------------
#include <windows.h>
#include "res.h"
MAIN_MENU MENU
{
POPUP "&File" {
MENUITEM "&Open", IDM_OPEN
MENUITEM "&Close", IDM_CLOSE
}
}
-------------- next part --------------
--- dlls/user/menu.c.orig 2005-03-30 15:59:28.000000000 -0300
+++ dlls/user/menu.c 2005-04-15 15:21:02.000000000 -0300
@@ -2866,7 +2866,9 @@
}
else
{
+ PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
DispatchMessageW( &msg );
+ continue;
}
if (!fEndMenu) fRemove = TRUE;
More information about the wine-devel
mailing list