From 28e85253720f1d4f4b29d94fe9d3859a4a735dc3 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Wed, 15 Feb 2017 15:58:21 -0500 Subject: [PATCH] [w2file] Fix shutdown assert in checked mode console_close triggered a MONO_REQ_GC_SAFE_MODE assert in checked mode on because the console handles were unref'd which caused them to close. Until w32handle is coop-aware, just transition to GC unsafe mode (a noop if it's already in unsafe) in these callbacks. --- mono/metadata/w32file-unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mono/metadata/w32file-unix.c b/mono/metadata/w32file-unix.c index 09eb6b1bc87..9666cb67d9d 100644 --- a/mono/metadata/w32file-unix.c +++ b/mono/metadata/w32file-unix.c @@ -1099,7 +1099,7 @@ static void _wapi_set_last_path_error_from_errno (const gchar *dir, */ static void file_close (gpointer handle, gpointer data) { - MONO_REQ_GC_SAFE_MODE; /* FIXME: after mono_w32handle_close is coop-aware, change this to UNSAFE_MODE and switch to SAFE around close() below */ + /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */ MONO_ENTER_GC_UNSAFE; MonoW32HandleFile *file_handle = (MonoW32HandleFile *)data; gint fd = file_handle->fd; @@ -1839,7 +1839,7 @@ static gboolean file_setfiletime(gpointer handle, static void console_close (gpointer handle, gpointer data) { - MONO_REQ_GC_SAFE_MODE; /* FIXME: after mono_w32handle_close is coop-aware, change this to UNSAFE_MODE and switch to SAFE around close() below */ + /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */ MONO_ENTER_GC_UNSAFE; MonoW32HandleFile *console_handle = (MonoW32HandleFile *)data; gint fd = console_handle->fd; @@ -1998,7 +1998,7 @@ static gsize find_typesize (void) static void pipe_close (gpointer handle, gpointer data) { - MONO_REQ_GC_SAFE_MODE; /* FIXME: after mono_w32handle_close is coop-aware, change this to UNSAFE_MODE and switch to SAFE around close() below */ + /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */ MONO_ENTER_GC_UNSAFE; MonoW32HandleFile *pipe_handle = (MonoW32HandleFile*)data; gint fd = pipe_handle->fd; -- 2.25.1