Skip to content

Commit a4cab7d

Browse files
authored
[mono]mono_runtime_delegate_invoke change to gc unsafe state (#62003)
* mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE; mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE; * Update object.c
1 parent 12a8819 commit a4cab7d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/mono/mono/metadata/object.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,24 +3714,25 @@ mono_get_delegate_end_invoke_checked (MonoClass *klass, MonoError *error)
37143714
MonoObject*
37153715
mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc)
37163716
{
3717-
MONO_REQ_GC_UNSAFE_MODE;
3718-
37193717
ERROR_DECL (error);
3718+
MonoObject* result = NULL;
3719+
MONO_ENTER_GC_UNSAFE;
37203720
if (exc) {
3721-
MonoObject *result = mono_runtime_delegate_try_invoke (delegate, params, exc, error);
3721+
result = mono_runtime_delegate_try_invoke (delegate, params, exc, error);
37223722
if (*exc) {
37233723
mono_error_cleanup (error);
3724-
return NULL;
3724+
result = NULL;
37253725
} else {
37263726
if (!is_ok (error))
37273727
*exc = (MonoObject*)mono_error_convert_to_exception (error);
3728-
return result;
37293728
}
37303729
} else {
3731-
MonoObject *result = mono_runtime_delegate_invoke_checked (delegate, params, error);
3730+
result = mono_runtime_delegate_invoke_checked (delegate, params, error);
37323731
mono_error_raise_exception_deprecated (error); /* OK to throw, external only without a good alternative */
3733-
return result;
3732+
37343733
}
3734+
MONO_EXIT_GC_UNSAFE;
3735+
return result;
37353736
}
37363737

37373738
/**

0 commit comments

Comments
 (0)