Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid static initialization order fiasco in soundman.cpp #80

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

majcosta
Copy link
Contributor

@majcosta majcosta commented Jan 16, 2023

When running the CMake Debug build instead of ja2_vs2019.sln, s_SoundLog is undefined inside SoundLog(CHAR8*). The most likely reason for that is that static objects in global scope have unspecified initialization order. The problem is fixed if the static SoundLog object is created inside the SoundLog(CHAR8*) function instead so that s_SoundLog's lifetime becomes defined.

Also removed the comment whose meaning apparently has been lost to the sands of time.

when running the cmake Debug build instead of the ja2_vs2019.sln file s_SoundLog is undefined.
the most likely reason for that is that static objects in global scope
have unspecified initialization order. the problem is fixed if the
static SoundLog object is created inside the SoundLog(CHAR8*) function
instead.

also remove the comment whose meaning apparently has been lost to the
sands of time
@rftrdev rftrdev merged commit 6b0c704 into 1dot13:master Jan 18, 2023
@majcosta majcosta deleted the pr_fix_debug_build_cmake branch January 18, 2023 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants