[runtime] Move the test for shutting down the stat profiler to mini_cleanup ().
[mono.git] / mono / mini / mini-runtime.c
index fdb1669c807f9f7defb1a6a9cc0fb88d51884bc0..f331f0c083556d2ac50db68b50ebf6139cdfd82f 100644 (file)
@@ -4164,7 +4164,8 @@ print_jit_stats (void)
 void
 mini_cleanup (MonoDomain *domain)
 {
-       mono_runtime_shutdown_stat_profiler ();
+       if (mono_profiler_get_events () & MONO_PROFILE_STATISTICAL)
+               mono_runtime_shutdown_stat_profiler ();
 
 #ifndef DISABLE_COM
        cominterop_release_all_rcws ();