combase: Move global apartment state cleanup.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-28 11:05:19 +03:00 committed by Alexandre Julliard
parent fad7818e28
commit 904f5fd0f6
6 changed files with 3 additions and 4 deletions

View File

@ -1271,7 +1271,7 @@ HWND WINAPI apartment_getwindow(const struct apartment *apt)
return apt->win;
}
void WINAPI apartment_global_cleanup(void)
void apartment_global_cleanup(void)
{
if (apt_win_class)
UnregisterClassW((const WCHAR *)MAKEINTATOM(apt_win_class), hProxyDll);

View File

@ -2952,6 +2952,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
apartment_global_cleanup();
DeleteCriticalSection(&registered_classes_cs);
break;
}

View File

@ -357,6 +357,5 @@
@ stdcall leave_apartment(ptr)
@ stdcall apartment_findfromoxid(int64)
@ stdcall apartment_getwindow(ptr)
@ stdcall apartment_global_cleanup()
@ stdcall apartment_createwindowifneeded(ptr)
@ stdcall apartment_findfromtid(long)

View File

@ -105,6 +105,7 @@ static inline struct apartment* com_get_current_apt(void)
HWND WINAPI apartment_getwindow(const 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_global_cleanup(void) DECLSPEC_HIDDEN;
/* RpcSs interface */
HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN;

View File

@ -1323,7 +1323,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
if (reserved) break;
release_std_git();
RPC_UnregisterAllChannelHooks();
apartment_global_cleanup();
break;
case DLL_THREAD_DETACH:

View File

@ -248,7 +248,6 @@ extern HRESULT WINAPI enter_apartment(struct oletls *info, DWORD model) DECLSPEC
void WINAPI leave_apartment(struct oletls *info) 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 void WINAPI apartment_global_cleanup(void) DECLSPEC_HIDDEN;
/* DCOM messages used by the apartment window (not compatible with native) */
#define DM_EXECUTERPC (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */