-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix deadlock inside BASS library finalization. #223
Fix deadlock inside BASS library finalization. #223
Conversation
cleo_plugins/Audio/CSoundSystem.cpp
Outdated
@@ -52,7 +53,7 @@ namespace CLEO | |||
if (initialized) | |||
{ | |||
TRACE("Freeing BASS library"); | |||
BASS_Free(); | |||
std::thread(BASS_Free); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there a deadlock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library internally waits to some (COM?) objects to be finalized. BASS author says free can not be called in dll main. I tried to do it from some other callback like on game closing, but with same results. Other author suggestion is not to call free at all and let it be released automatically, but that makes game crashing (I guess due all ModLoader hacks).
Calling it from another thread works. It is visible in log that CLEO proceeded with other cleanup steps, game aslo closes without problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I would also remove free and let OS handle the unloading.
Is the crash reproducible 100%? Does it depend on other plugins installed in game?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like all you need is ModLoader. BASS_Free changing has some results in web search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it wasn't an issue in CLEO4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea. ModLoader is thin ice. In CLEO4 Bass was managed by core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm seems to be working without calling free at all. I have no idea why game was crashing for me when testing it previously.
No description provided.