systray[3/4]: Better validate icon owner

Kirill K. Smirnov lich at
Wed Feb 6 18:30:25 CST 2008

> I don't get why you need this change. PostMessage should correctly
> handle the case where icon->owner has been destroyed and adding a call
> to IsWindow just introduces a race condition.

Just a testcase:
1) run any wine app (to be sure that explorer is running), e.g winecfg
2) run taskmgr
3) select taskmgr process in tasklist and kill it. taskmgr window will 
dissapear but tray icon not.
4) move mouse cursor over taskmgr tray icon. Before this patch it will not 
dissapear, but should.

The reason is that ERROR_INVALID_HANDLE is not the only value which indicates 
the absence of owner window (ERROR_INVALID_WINDOW_HANDLE too). I think that 
using robust and straightforward IsWindow() function is better than verify 
last error.

Is it acceptable to check return value of PostMessage only and do not check 
last error?

And what race condition introduces IsWindow() here?


More information about the wine-devel mailing list