Hey everyone, I’ve got a bit of a problem with getting FMOD to unload, but the situation in which I’m using FMOD is a little bit weird.
I’m working on an injectable DLL that creates the FMOD system and will then use it. You can see a working version of the project here (http://www.youtube.com/watch?v=Gte4UPbx_5I). I am currently rewriting it from scratch and I want to switch over to FMOD (from irrKlang) as it has some features that would come in handy for further development, and I have a bit more experience with it at this point. The problem that I’m having is that I can create the FMOD system and use it just fine, but when it comes time to release it, it will hang.
If I release it before exiting the application I am injecting into, it will release fine and I will have no issues. On the other hand, if I exit the application and then try to unload it, it will hang when calling release (or close), but other functions, such as getVersion work fine. From debugging I believe that FMOD is running into memory that has already been deallocated/released (I believe it’s from the main application exiting). Because of the fact that the application I am injecting into isn’t written by me, it’s pretty difficult to be able to identify when the program is closing and release FMOD before then. I am currently unloading FMOD when my program encounters an error and terminates itself (in which case it will release fine), or when the DLL gets the message to detach (when the other application closes, it will hang in this case).
I’m not sure if there is much than can be done to help, but anything anyone has to offer would be greatly appreciated. Thanks-
Alright, I ended up solving the problem by hooking the main thread with SetWindowsHookEx() and running my termination code when capturing the WM_DESTORY message received by the main window (hence I can close before they do). Sorry about the post, but maybe this will help someone in the future.
- Zarradeth asked 7 years ago
- You must login to post comments