Commit 904f5fd0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

combase: Move global apartment state cleanup.

parent fad7818e
...@@ -1271,7 +1271,7 @@ HWND WINAPI apartment_getwindow(const struct apartment *apt) ...@@ -1271,7 +1271,7 @@ HWND WINAPI apartment_getwindow(const struct apartment *apt)
return apt->win; return apt->win;
} }
void WINAPI apartment_global_cleanup(void) void apartment_global_cleanup(void)
{ {
if (apt_win_class) if (apt_win_class)
UnregisterClassW((const WCHAR *)MAKEINTATOM(apt_win_class), hProxyDll); UnregisterClassW((const WCHAR *)MAKEINTATOM(apt_win_class), hProxyDll);
......
...@@ -2952,6 +2952,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) ...@@ -2952,6 +2952,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (reserved) break; if (reserved) break;
apartment_global_cleanup();
DeleteCriticalSection(&registered_classes_cs); DeleteCriticalSection(&registered_classes_cs);
break; break;
} }
......
...@@ -357,6 +357,5 @@ ...@@ -357,6 +357,5 @@
@ stdcall leave_apartment(ptr) @ stdcall leave_apartment(ptr)
@ stdcall apartment_findfromoxid(int64) @ stdcall apartment_findfromoxid(int64)
@ stdcall apartment_getwindow(ptr) @ stdcall apartment_getwindow(ptr)
@ stdcall apartment_global_cleanup()
@ stdcall apartment_createwindowifneeded(ptr) @ stdcall apartment_createwindowifneeded(ptr)
@ stdcall apartment_findfromtid(long) @ stdcall apartment_findfromtid(long)
...@@ -105,6 +105,7 @@ static inline struct apartment* com_get_current_apt(void) ...@@ -105,6 +105,7 @@ static inline struct apartment* com_get_current_apt(void)
HWND WINAPI apartment_getwindow(const struct apartment *apt) DECLSPEC_HIDDEN; HWND WINAPI apartment_getwindow(const struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT WINAPI apartment_createwindowifneeded(struct apartment *apt) DECLSPEC_HIDDEN; HRESULT WINAPI apartment_createwindowifneeded(struct apartment *apt) DECLSPEC_HIDDEN;
void apartment_freeunusedlibraries(struct apartment *apt, DWORD unload_delay) DECLSPEC_HIDDEN; void apartment_freeunusedlibraries(struct apartment *apt, DWORD unload_delay) DECLSPEC_HIDDEN;
void apartment_global_cleanup(void) DECLSPEC_HIDDEN;
/* RpcSs interface */ /* RpcSs interface */
HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN; HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN;
......
...@@ -1323,7 +1323,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved) ...@@ -1323,7 +1323,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
if (reserved) break; if (reserved) break;
release_std_git(); release_std_git();
RPC_UnregisterAllChannelHooks(); RPC_UnregisterAllChannelHooks();
apartment_global_cleanup();
break; break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
......
...@@ -248,7 +248,6 @@ extern HRESULT WINAPI enter_apartment(struct oletls *info, DWORD model) DECLSPEC ...@@ -248,7 +248,6 @@ extern HRESULT WINAPI enter_apartment(struct oletls *info, DWORD model) DECLSPEC
void WINAPI leave_apartment(struct oletls *info) DECLSPEC_HIDDEN; void WINAPI leave_apartment(struct oletls *info) DECLSPEC_HIDDEN;
extern struct apartment * WINAPI apartment_get_current_or_mta(void) DECLSPEC_HIDDEN; extern struct apartment * WINAPI apartment_get_current_or_mta(void) DECLSPEC_HIDDEN;
extern HRESULT WINAPI apartment_get_local_server_stream(struct apartment *apt, IStream **ret) DECLSPEC_HIDDEN; extern HRESULT WINAPI apartment_get_local_server_stream(struct apartment *apt, IStream **ret) DECLSPEC_HIDDEN;
extern void WINAPI apartment_global_cleanup(void) DECLSPEC_HIDDEN;
/* DCOM messages used by the apartment window (not compatible with native) */ /* DCOM messages used by the apartment window (not compatible with native) */
#define DM_EXECUTERPC (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */ #define DM_EXECUTERPC (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment