http://bugs.winehq.org/show_bug.cgi?id=8301
------- Additional Comments From dmitry@codeweavers.com 2007-13-05 12:00 -------
This is chicken and an egg problem. If application did not destroy all of the objects, you should not be able to just unload the dll.
Windows unloads a dll which has created a thread or a window as well as Wine does, that's a responsibility of a dll to make sure that it destroys all critical resources before it gets unloaded.
However there is a race in this code. Window doesn't get destroyed before owning thread exits and dll unloaded. I will see what I can do about this.
Vitaliy, the patch you sent to wine-patches looks reasonable, thanks!