http://bugs.winehq.org/show_bug.cgi?id=20711
--- Comment #26 from Henri Verbeet hverbeet@gmail.com 2010-03-30 09:30:34 --- (In reply to comment #25)
Doesn't that still try to call FreeLibrary() from apartment_release() -> COMPOBJ_DllList_ReleaseRef() though?
GetModuleHandleExW(0, ... increases the reference counter and ensures that the library is still loaded. So we can survive another call to FreeLibrary until DllCanUnloadNow is called. In this case we have to call FreeLibrary twice. One can be done in the original position.
Yes, but that's only if the library was still loaded. If it's already unloaded we're passing an invalid handle to FreeLibrary().