From 4beda167575f24eaed7da4ee3cbbc92f6bea6339 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 7 Jun 2020 17:23:29 -0500 Subject: [PATCH] quartz: Free type libraries on process detach (Valgrind). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/main.c | 5 ++++- dlls/strmbase/dispatch.c | 13 +++++++++++++ include/wine/strmbase.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 4acb4f1a795..303cc30a931 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -31,8 +31,11 @@ LONG object_locks = 0; BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { - if (reason == DLL_PROCESS_DETACH) + if (reason == DLL_PROCESS_DETACH && !reserved) + { video_window_unregister_class(); + strmbase_release_typelibs(); + } return QUARTZ_DllMain(instance, reason, reserved); } diff --git a/dlls/strmbase/dispatch.c b/dlls/strmbase/dispatch.c index 25573fa1a26..de817f20c0d 100644 --- a/dlls/strmbase/dispatch.c +++ b/dlls/strmbase/dispatch.c @@ -68,3 +68,16 @@ HRESULT strmbase_get_typeinfo(enum strmbase_type_id tid, ITypeInfo **ret) ITypeInfo_AddRef(*ret = control_typeinfo[tid]); return S_OK; } + +void strmbase_release_typelibs(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(control_typeinfo); ++i) + { + if (control_typeinfo[i]) + ITypeInfo_Release(control_typeinfo[i]); + } + if (control_typelib) + ITypeLib_Release(control_typelib); +} diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 6789957e50a..02a5469de17 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -252,6 +252,7 @@ enum strmbase_type_id }; HRESULT strmbase_get_typeinfo(enum strmbase_type_id tid, ITypeInfo **typeinfo); +void strmbase_release_typelibs(void); struct strmbase_passthrough {