Fix static initialisation order fiasco issue for Version variables

Fixes a crash that could occur if the static constructor function for
the MainSettings.cpp TU happened to run before the variables in
Common/Version.cpp are initialised. (This is known as the static
initialisation order fiasco.)

By using wrapper functions, those variables are now guaranteed to be
constructed on first use.
This commit is contained in:
Léo Lam
2022-01-14 00:04:22 +01:00
parent 07fd17445c
commit 83c5446d85
23 changed files with 86 additions and 54 deletions

View File

@ -363,7 +363,7 @@ bool ProgramShaderCache::CheckShaderCompileResult(GLuint id, GLenum type, std::s
File::OpenFStream(file, filename, std::ios_base::out);
file << s_glsl_header << code << info_log;
file << "\n";
file << "Dolphin Version: " + Common::scm_rev_str + "\n";
file << "Dolphin Version: " + Common::GetScmRevStr() + "\n";
file << "Video Backend: " + g_video_backend->GetDisplayName();
file.close();
@ -408,7 +408,7 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, std::string_view vcod
file << info_log;
file << "\n";
file << "Dolphin Version: " + Common::scm_rev_str + "\n";
file << "Dolphin Version: " + Common::GetScmRevStr() + "\n";
file << "Video Backend: " + g_video_backend->GetDisplayName();
file.close();