Reactos

[CRT] Do not call atexit at process initialization

There is no guarantee that the underlying APIs are initialized at this point

CORE-17362

authored by

Jérôme Gardou and committed by
Jérôme Gardou
6c6d9bee 26863538

+9 -5
+9 -3
sdk/lib/crt/startup/crtexe.c
··· 115 115 116 116 extern int _MINGW_INSTALL_DEBUG_MATHERR; 117 117 118 + #ifdef __GNUC__ 119 + extern void __do_global_dtors(void); 120 + #endif 121 + 118 122 static int __cdecl 119 123 pre_c_init (void) 120 124 { ··· 210 214 #endif 211 215 return ret; 212 216 } 213 - 214 - void __call_atexit(); 215 217 216 218 static 217 219 __declspec(noinline) ··· 326 328 #endif 327 329 mainret = main (argc, argv, envp); 328 330 #endif 329 - __call_atexit(); 331 + 332 + #ifdef __GNUC__ 333 + __do_global_dtors(); 334 + #endif 335 + 330 336 if (!managedapp) 331 337 exit (mainret); 332 338
-2
sdk/lib/crt/startup/gccmain.c
··· 43 43 { 44 44 __CTOR_LIST__[i] (); 45 45 } 46 - 47 - atexit (__do_global_dtors); 48 46 } 49 47 50 48 static int initialized = 0;