>From 09aa090aa7f72ac8ab86d9e70767ba648ef05c6f Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 24 Feb 2022 18:09:57 +0300 Subject: [PATCH 9/9] combase: Call ISurrogate::FreeSurrogate() if the list of DLLs loaded into the apartment is empty. Content-Type: text/plain; charset=UTF-8 To: wine-devel@winehq.org Signed-off-by: Dmitry Timoshkov --- dlls/combase/apartment.c | 7 +++++++ dlls/combase/combase.c | 7 ++++--- dlls/combase/combase_private.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/combase/apartment.c b/dlls/combase/apartment.c index c1b381879d3..1797074e8e3 100644 --- a/dlls/combase/apartment.c +++ b/dlls/combase/apartment.c @@ -440,6 +440,13 @@ void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay) else if (entry->unload_time) entry->unload_time = 0; } + + if (if_surrogate && list_empty(&apt->loaded_dlls)) + { + ISurrogate_FreeSurrogate(if_surrogate); + if_surrogate = NULL; + } + LeaveCriticalSection(&apt->cs); } diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 3ffd08ab635..7bc4e75836c 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); HINSTANCE hProxyDll; +ISurrogate *if_surrogate; static ULONG_PTR global_options[COMGLB_PROPERTIES_RESERVED3 + 1]; @@ -3340,9 +3341,9 @@ HRESULT WINAPI CoResumeClassObjects(void) */ HRESULT WINAPI CoRegisterSurrogate(ISurrogate *surrogate) { - FIXME("%p stub\n", surrogate); - - return E_NOTIMPL; + TRACE("%p\n", surrogate); + if_surrogate = surrogate; + return S_OK; } /*********************************************************************** diff --git a/dlls/combase/combase_private.h b/dlls/combase/combase_private.h index 9247af4ebb6..1db070d8636 100644 --- a/dlls/combase/combase_private.h +++ b/dlls/combase/combase_private.h @@ -21,6 +21,7 @@ #include "wine/list.h" extern HINSTANCE hProxyDll; +extern ISurrogate *if_surrogate DECLSPEC_HIDDEN; struct apartment { -- 2.35.1