Skip to content

Commit

Permalink
Deinit Globals properly if application_create fails.
Browse files Browse the repository at this point in the history
Fixes STL crash on MSVC if stray threads call into STL.
  • Loading branch information
Themaister committed Jul 17, 2024
1 parent 126aa09 commit 8917a9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions application/platforms/application_sdl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ int application_main(
return exit_code;

auto app = std::unique_ptr<Application>(create_application(argc, argv));
int ret;

if (app)
{
Expand All @@ -841,9 +842,14 @@ int application_main(

app.reset();
Global::deinit();
return 0;
ret = EXIT_SUCCESS;
}
else
return 1;
{
ret = EXIT_FAILURE;
}

Global::deinit();
return ret;
}
}

0 comments on commit 8917a9a

Please sign in to comment.