I tried to log std::exit
calls in my GCC10 compiled Qt 5 application. This fails when turning a QDateTime
object into a string. It can be reproduced with the following snippet:
void exitHandler() noexcept
{
QString b = QDateTime::currentDateTime().toString();
}
int main(int pArgc, char* pArgv[]) noexcept
{
std::atexit(&exitHandler);
QString a = QDateTime::currentDateTime().toString();
std::exit(1);
return 0;
}
Variable a
contains the expected date/time while variable b
is empty. When using UTC time, b
is " GMT". I am not aware of any related restrictions of exit-handlers.
Can someone tell me what is going wrong here?