quartz: Implement proper DLL refcounting.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48734 Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3b8b066713
commit
cb3dc98928
|
@ -493,6 +493,8 @@ static void acm_wrapper_destroy(struct strmbase_filter *iface)
|
|||
IUnknown_Release(filter->seeking);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
free(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT acm_wrapper_init_stream(struct strmbase_filter *iface)
|
||||
|
|
|
@ -489,6 +489,8 @@ static void avi_decompressor_destroy(struct strmbase_filter *iface)
|
|||
IUnknown_Release(filter->seeking);
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
free(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
|
||||
|
|
|
@ -503,6 +503,8 @@ static void dsound_render_destroy(struct strmbase_renderer *iface)
|
|||
|
||||
strmbase_renderer_cleanup(&filter->renderer);
|
||||
CoTaskMemFree(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT dsound_render_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
|
||||
|
|
|
@ -353,6 +353,8 @@ static void async_reader_destroy(struct strmbase_filter *iface)
|
|||
|
||||
strmbase_filter_cleanup(&filter->filter);
|
||||
free(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT async_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
|
||||
|
|
|
@ -518,6 +518,8 @@ static ULONG WINAPI FilterGraphInner_Release(IUnknown *iface)
|
|||
}
|
||||
DeleteCriticalSection(&This->cs);
|
||||
CoTaskMemFree(This);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -193,8 +193,12 @@ static ULONG WINAPI Inner_Release(IUnknown *iface)
|
|||
TRACE("(%p)->(): new ref = %d\n", This, ref);
|
||||
|
||||
if (ref == 0)
|
||||
{
|
||||
CoTaskMemFree(This);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ extern HRESULT WINAPI QUARTZ_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLS
|
|||
extern HRESULT WINAPI QUARTZ_DllCanUnloadNow(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL WINAPI QUARTZ_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
|
||||
|
||||
static LONG server_locks = 0;
|
||||
LONG object_locks = 0;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
{
|
||||
|
@ -124,6 +124,7 @@ static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter
|
|||
|
||||
if (SUCCEEDED(hres = This->create_instance(pOuter, &punk)))
|
||||
{
|
||||
InterlockedIncrement(&object_locks);
|
||||
hres = IUnknown_QueryInterface(punk, riid, ppobj);
|
||||
IUnknown_Release(punk);
|
||||
}
|
||||
|
@ -135,9 +136,9 @@ static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
|
|||
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
||||
if(dolock)
|
||||
InterlockedIncrement(&server_locks);
|
||||
InterlockedIncrement(&object_locks);
|
||||
else
|
||||
InterlockedDecrement(&server_locks);
|
||||
InterlockedDecrement(&object_locks);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -200,7 +201,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||
*/
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
if(server_locks == 0 && QUARTZ_DllCanUnloadNow() == S_OK)
|
||||
if (!object_locks && QUARTZ_DllCanUnloadNow() == S_OK)
|
||||
return S_OK;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
|
|
@ -911,6 +911,8 @@ static void StdMemAllocator_Destroy(IMemAllocator *iface)
|
|||
DeleteCriticalSection(&This->csState);
|
||||
|
||||
CoTaskMemFree(This);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
HRESULT mem_allocator_create(IUnknown *lpUnkOuter, IUnknown **out)
|
||||
|
|
|
@ -80,6 +80,8 @@ static ULONG WINAPI seeking_passthrough_Release(IUnknown *iface)
|
|||
{
|
||||
strmbase_passthrough_cleanup(&passthrough->passthrough);
|
||||
free(passthrough);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
return refcount;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ static inline const char *debugstr_time(REFERENCE_TIME time)
|
|||
return wine_dbg_sprintf("%s", rev);
|
||||
}
|
||||
|
||||
extern LONG object_locks;
|
||||
|
||||
/* see IAsyncReader::Request on MSDN for the explanation of this */
|
||||
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
|
||||
#define BYTES_FROM_MEDIATIME(time) ((time) / 10000000)
|
||||
|
|
|
@ -105,6 +105,8 @@ static ULONG WINAPI system_clock_inner_Release(IUnknown *iface)
|
|||
clock->cs.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&clock->cs);
|
||||
heap_free(clock);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
return refcount;
|
||||
}
|
||||
|
|
|
@ -248,6 +248,8 @@ static void video_renderer_destroy(struct strmbase_renderer *iface)
|
|||
CloseHandle(filter->run_event);
|
||||
strmbase_renderer_cleanup(&filter->renderer);
|
||||
CoTaskMemFree(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT video_renderer_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
|
||||
|
|
|
@ -519,6 +519,8 @@ static void vmr_destroy(struct strmbase_renderer *iface)
|
|||
BaseControlWindow_Destroy(&filter->baseControlWindow);
|
||||
strmbase_renderer_cleanup(&filter->renderer);
|
||||
CoTaskMemFree(filter);
|
||||
|
||||
InterlockedDecrement(&object_locks);
|
||||
}
|
||||
|
||||
static HRESULT vmr_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
|
||||
|
|
Loading…
Reference in New Issue