Skip to content

Commit 37f8894

Browse files
committed
Expose mono_class_is_open_constructed_type to Unity to allow us to check to see if the class is not yet fully instantiated prior to asttempting to call mono_object_new on it.
* Also cleaning up a minor leak of a MonoError in mono_unity_class_inflate_generic_class
1 parent ad6f94d commit 37f8894

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

mono/metadata/unity-utils.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,10 @@ MonoClass* mono_unity_class_get_generic_definition(MonoClass* klass)
287287
MonoClass* mono_unity_class_inflate_generic_class(MonoClass *gklass, MonoGenericContext *context)
288288
{
289289
MonoError error;
290-
return mono_class_inflate_generic_class_checked(gklass, context, &error);
290+
MonoClass* klass;
291+
klass = mono_class_inflate_generic_class_checked(gklass, context, &error);
292+
mono_error_cleanup (&error);
293+
return klass;
291294
}
292295

293296
gboolean mono_unity_class_has_parent_unsafe(MonoClass *klass, MonoClass *parent)
@@ -1945,4 +1948,10 @@ MONO_API uint32_t
19451948
mono_unity_allocation_granularity()
19461949
{
19471950
return (uint32_t)(2 * sizeof(void *));
1948-
}
1951+
}
1952+
1953+
MONO_API gboolean
1954+
mono_unity_class_is_open_constructed_type (MonoClass *klass)
1955+
{
1956+
return mono_class_is_open_constructed_type (&klass->byval_arg);
1957+
}

mono/metadata/unity-utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,6 @@ mono_unity_set_enable_handler_block_guards (mono_bool allow);
219219
mono_bool
220220
mono_unity_get_enable_handler_block_guards (void);
221221

222+
MONO_API gboolean mono_unity_class_is_open_constructed_type (MonoClass *klass);
223+
222224
#endif

0 commit comments

Comments
 (0)