[CRT] Do not call atexit at process initialization

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

CORE-17362
This commit is contained in:
Jérôme Gardou
2020-12-28 10:47:38 +01:00
committed by Jérôme Gardou
parent 26863538a4
commit 6c6d9bee68
2 changed files with 9 additions and 5 deletions

View File

@@ -115,6 +115,10 @@ _CRTALLOC(".CRT$XCAA") _PVFV mingw_pcppinit = pre_cpp_init;
extern int _MINGW_INSTALL_DEBUG_MATHERR;
#ifdef __GNUC__
extern void __do_global_dtors(void);
#endif
static int __cdecl
pre_c_init (void)
{
@@ -211,8 +215,6 @@ int __cdecl mainCRTStartup (void)
return ret;
}
void __call_atexit();
static
__declspec(noinline)
int __cdecl
@@ -326,7 +328,11 @@ __tmainCRTStartup (void)
#endif
mainret = main (argc, argv, envp);
#endif
__call_atexit();
#ifdef __GNUC__
__do_global_dtors();
#endif
if (!managedapp)
exit (mainret);

View File

@@ -43,8 +43,6 @@ __do_global_ctors (void)
{
__CTOR_LIST__[i] ();
}
atexit (__do_global_dtors);
}
static int initialized = 0;