Zebediah Figura : quartz: Unregister the video window class on DLL unload.

Alexandre Julliard julliard at winehq.org
Thu Mar 12 17:09:05 CDT 2020


Module: wine
Branch: master
Commit: 2db87b733f92f8541de6ba4dafefb8f05eb9aae0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2db87b733f92f8541de6ba4dafefb8f05eb9aae0

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Mar 11 21:10:13 2020 -0500

quartz: Unregister the video window class on DLL unload.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48734
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/main.c           | 7 ++++---
 dlls/quartz/quartz_private.h | 1 +
 dlls/quartz/window.c         | 6 ++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c
index 9c61dd50d7..284f2cacae 100644
--- a/dlls/quartz/main.c
+++ b/dlls/quartz/main.c
@@ -29,10 +29,11 @@ extern BOOL WINAPI QUARTZ_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
 
 static LONG server_locks = 0;
 
-/* For the moment, do nothing here. */
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
 {
-    return QUARTZ_DllMain( hInstDLL, fdwReason, lpv );
+    if (reason == DLL_PROCESS_DETACH)
+        video_window_unregister_class();
+    return QUARTZ_DllMain(instance, reason, reserved);
 }
 
 static HRESULT seeking_passthrough_create(IUnknown *outer, IUnknown **out)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
index 2b100969eb..3332c27d21 100644
--- a/dlls/quartz/quartz_private.h
+++ b/dlls/quartz/quartz_private.h
@@ -123,6 +123,7 @@ typedef struct tagBaseControlWindow
 
 HRESULT video_window_init(BaseControlWindow *window, const IVideoWindowVtbl *vtbl,
         struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseWindowFuncTable *func_table) DECLSPEC_HIDDEN;
+void video_window_unregister_class(void) DECLSPEC_HIDDEN;
 HRESULT WINAPI BaseControlWindow_Destroy(BaseControlWindow *pControlWindow) DECLSPEC_HIDDEN;
 
 BOOL WINAPI BaseControlWindowImpl_PossiblyEatMessage(BaseWindow *This, UINT uMsg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c
index 6e1a60086f..0b0df136f2 100644
--- a/dlls/quartz/window.c
+++ b/dlls/quartz/window.c
@@ -741,3 +741,9 @@ HRESULT WINAPI BaseControlWindowImpl_IsCursorHidden(IVideoWindow *iface, LONG *C
 
     return S_OK;
 }
+
+void video_window_unregister_class(void)
+{
+    if (!UnregisterClassW(class_name, NULL) && GetLastError() != ERROR_CLASS_DOES_NOT_EXIST)
+        ERR("Failed to unregister class, error %u.\n", GetLastError());
+}




More information about the wine-cvs mailing list