implement DllCanUnloadNow for dmusic

Robert Shearman rob at codeweavers.com
Sat Dec 4 17:15:16 CST 2004


James Hawkins wrote:

>On Sat, 04 Dec 2004 15:13:47 -0600, Robert Shearman <rob at codeweavers.com> wrote:
>  
>
>>Ok, think about this sequence of events that should leave the DLL ref
>>count at 0:
>>1. Create an IDirectMusicBufferImpl object.
>>1a. Calls LockModule.
>>1b. Calls QueryInterface which calls LockModule.
>>2. Call Release, which calls LockModule.
>>
>>The solution is to either remove the LockModule from the constructor, or
>>to remove the LockModule from the AddRef and only call UnlockModule in
>>the destructor part of Release. This issue is also present in the other
>>files in your patch (not quoted here).
>>
>>I should have thought about this before when I commented on your last
>>patch. I guess I need to put some tests together for this feature.
>>
>>Rob
>>
>>    
>>
>
>MSDN about QueryInterface:
>"Returns a pointer to a specified interface on an object to which a
>client currently holds an interface pointer. This function must call
>IUnknown::AddRef on the pointer it returns."
>
>QueryInterface should be calling AddRef, so if any constructor calls
>QueryInterface (I'm guessing without looking that they all do) then
>there shouldn't be a call to LockModule in that constructor.  Is that
>about right?
>  
>

That is correct.

Rob



More information about the wine-devel mailing list