Module: wine
Branch: master
Commit: 276d202e792d78c1298795fa72a95c47a182160a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=276d202e792d78c1298795fa7…
Author: Vincent Povirk <vincent(a)codeweavers.com>
Date: Thu Feb 28 15:43:25 2013 -0600
mscoree: Keep a reference to mscoree when shutting down.
---
dlls/mscoree/metahost.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 143494c..6906075 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -313,6 +313,12 @@ static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost *
void unload_all_runtimes(void)
{
int i;
+ HMODULE handle;
+
+ /* If the only references to mscoree are through dll's that were loaded by
+ * Mono, shutting down the Mono runtime will free mscoree, so take a
+ * reference to prevent that from happening. */
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const WCHAR *)&unload_all_runtimes, &handle);
for (i=0; i<NUM_ABI_VERSIONS; i++)
{