Adjust mono_class_init_internal to no longer bypass cleanup when a fa… (#21964)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Sun, 2 Feb 2020 16:29:45 +0000 (11:29 -0500)
committerGitHub <noreply@github.com>
Sun, 2 Feb 2020 16:29:45 +0000 (11:29 -0500)
…ilure is detected.

This fixes: https://issuetracker.unity3d.com/issues/unity-physics-collisions-do-not-work-and-errors-are-thrown-when-entering-play-mode

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: Alex Thibodeau <alexthibodeau@unity3d.com>
src/mono/mono/metadata/class-init.c

index 3529a2824f346dd5b534f6f6854af279247def5c..3a8cd75b2500e7def420944d161eb53d1522ec7f 100644 (file)
@@ -4548,9 +4548,8 @@ mono_class_init_internal (MonoClass *klass)
        locked = TRUE;
 
        if (klass->inited || mono_class_has_failure (klass)) {
-               mono_loader_unlock ();
                /* Somebody might have gotten in before us */
-               return !mono_class_has_failure (klass);
+               goto leave;
        }
 
        UnlockedIncrement (&mono_stats.initialized_class_count);