Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/main.c | 3 +++ dlls/strmbase/dispatch.c | 13 +++++++++++++ include/wine/strmbase.h | 1 + 3 files changed, 17 insertions(+)
diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 4acb4f1a79..9266987c2e 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -32,7 +32,10 @@ LONG object_locks = 0; BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { if (reason == DLL_PROCESS_DETACH) + { 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 25573fa1a2..5d3d9aad99 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); + } + if (control_typelib) + ITypeLib_Release(control_typelib); +} diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 6789957e50..02a5469de1 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 {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/main.c | 21 ++++++++++++--------- dlls/qedit/mediadet.c | 1 - dlls/qedit/qedit_private.h | 1 + dlls/qedit/samplegrabber.c | 1 - 4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/dlls/qedit/main.c b/dlls/qedit/main.c index f4d1bbb061..cc5da4edf5 100644 --- a/dlls/qedit/main.c +++ b/dlls/qedit/main.c @@ -23,15 +23,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
-static HINSTANCE instance; +static HINSTANCE qedit_instance;
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { - switch(fdwReason) { - case DLL_PROCESS_ATTACH: - instance = hInstDLL; - DisableThreadLibraryCalls(hInstDLL); - break; + if (reason == DLL_PROCESS_ATTACH) + { + qedit_instance = instance; + DisableThreadLibraryCalls(instance); + } + else if (reason == DLL_PROCESS_DETACH) + { + strmbase_release_typelibs(); } return TRUE; } @@ -243,7 +246,7 @@ HRESULT WINAPI DllRegisterServer(void) IFilterMapper2 *mapper; HRESULT hr;
- if (FAILED(hr = __wine_register_resources( instance ))) + if (FAILED(hr = __wine_register_resources(qedit_instance))) return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, @@ -267,7 +270,7 @@ HRESULT WINAPI DllUnregisterServer(void) IFilterMapper2 *mapper; HRESULT hr;
- if (FAILED(hr = __wine_unregister_resources( instance ))) + if (FAILED(hr = __wine_unregister_resources(qedit_instance))) return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index d32679b6bb..e1defaa9a6 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -28,7 +28,6 @@ #include "ole2.h"
#include "qedit_private.h" -#include "wine/strmbase.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(qedit); diff --git a/dlls/qedit/qedit_private.h b/dlls/qedit/qedit_private.h index 7011c9f70d..0c0655084d 100644 --- a/dlls/qedit/qedit_private.h +++ b/dlls/qedit/qedit_private.h @@ -32,6 +32,7 @@ #include "winuser.h" #include "dshow.h" #include "qedit.h" +#include "wine/strmbase.h"
HRESULT timeline_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; HRESULT media_detector_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index bd8480df48..1619111f95 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -29,7 +29,6 @@
#include "qedit_private.h" #include "wine/debug.h" -#include "wine/strmbase.h"
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qasf/qasf_main.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/qasf/qasf_main.c b/dlls/qasf/qasf_main.c index 2e65b693fa..bcef11fa5c 100644 --- a/dlls/qasf/qasf_main.c +++ b/dlls/qasf/qasf_main.c @@ -108,6 +108,10 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) DisableThreadLibraryCalls(instance); qasf_instance = instance; } + else if (reason == DLL_PROCESS_DETACH) + { + strmbase_release_typelibs(); + } return TRUE; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=73018
Your paranoid android.
=== debiant (32 bit WoW report) ===
quartz: videorenderer.c:1053: Test failed: Got hr 0xdeadbeef. videorenderer.c:1054: Test failed: Got time 3a005a00000001.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/evr/evr.c | 1 - dlls/evr/evr_private.h | 1 + dlls/evr/main.c | 19 +++++++++---------- 3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 911075de33..001839026b 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -24,7 +24,6 @@
#include "evr_private.h" #include "d3d9.h" -#include "wine/strmbase.h"
#include "initguid.h" #include "dxva2api.h" diff --git a/dlls/evr/evr_private.h b/dlls/evr/evr_private.h index 65dcbb7a9b..ad47bd28b7 100644 --- a/dlls/evr/evr_private.h +++ b/dlls/evr/evr_private.h @@ -21,6 +21,7 @@
#include "dshow.h" #include "evr.h" +#include "wine/strmbase.h"
HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv) DECLSPEC_HIDDEN;
diff --git a/dlls/evr/main.c b/dlls/evr/main.c index 000ed7c55b..f10e229924 100644 --- a/dlls/evr/main.c +++ b/dlls/evr/main.c @@ -36,18 +36,17 @@ static HINSTANCE instance_evr;
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { - TRACE("(%p, %d, %p)\n", instance, reason, reserved); - - switch (reason) + if (reason == DLL_WINE_PREATTACH) + return FALSE; /* prefer native version */ + else if (reason == DLL_PROCESS_ATTACH) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - instance_evr = instance; - DisableThreadLibraryCalls(instance); - break; + instance_evr = instance; + DisableThreadLibraryCalls(instance); + } + else if (reason == DLL_PROCESS_DETACH) + { + strmbase_release_typelibs(); } - return TRUE; }