-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Access Violation error in the destructor of sf::AudioDevice #30
Comments
Which version of SFML? Which libraries (dynamic or static)? Are you sure that you use the openal32.dll file provided in the extlibs/bin directory? |
I use the dll versions of this SFML2's revision :
I use the openal32.dll file provided in the extlibs/bin/x86/ directory. |
With the statics versions (debug & release), the error doesn't occur. |
Ok, I know what's wrong. Thanks for your feedback. |
I am having the same problem in Windows 7.
Same issue: It crashes in the deconstructor, although the exact line it fails on depends on whether or not the context has been created. I'm free to experiment if there is a fix you'd like to try. I have the SFML git repo separate from the output from Cmake. |
Thanks for your feedback. Like I said previously, I know what's wrong and I'll fix it soon. |
been quiet here for a while, Any news about this bug? i really really need a fix as soon as possible. tanks |
As you can see, it's planned for SFML 2.x, not 2.0. So it's not the top priority, sorry. |
Laurent can you explain a bit more on "Ok, I know what's wrong", so we can have a look and maybe submit a patch at some point ? I'm also running into this issue. |
Yeah, it's simple: the AudioDevice instance is destroyed at global exit. |
If I don't use the openal32.dll that came with sfml2, this error does not seem to happen. The latest OpenAL32.dll loads up slow, but it does not crash on exit. |
The latest OpenAL32.dll from where? |
As far as I know, this version is not updated anymore.
|
hmm.. But strangely enough it works, for the time being. What codebase is the openal32 in the extlibs based on? |
The only implementation that is maintained and used everywhere now is OpenAL-Soft. |
yup, the binaries here - http://kcat.strangesoft.net/openal.html gives the error, which means we are back at square one |
I've got a similar crash on Windows 7 but on alcCloseDevice(audioDevice); in my project (different code). The sample code provided here to reproduce the bug correctly produces alcDestroyContext() bug though. However the 1.14 DLL provided at http://kcat.strangesoft.net/openal.html#download fixes both my crash and the one quoted in this issue (NB: in the readme they say the provided OpenAL binary isn't redistributable). Note that the 1.14 release is 9 days old. |
Even with the 1.14 OpenAL-Soft DLL, I was getting crashes on Windows XP 32bit SP3. I managed to fix the issue by removing SFML's AudioDevice deconstructor. It seems like OpenAL-Soft uses an atexit deconstructor to clean up after itself, which is the case with SFML's AudioDevice deconstructor too. This probably leads to OpenAL/SFML trying to deinitialize stuff that's already been destroyed. |
@matpow2 |
I have the same problem, with crashes very often. I can't wait any longer, any advice before i go and try to fix it myself ? |
The fix I did is actually a partial fix, there are no more crashes, but a lot of warnings in the console instead (not really a problem, but i don't like seeing warnings it means some errors might occur later). I will try to investigate later. |
Until you fix your fix (the diff shows all the files being completely changed -- probably due to different line breaks), there's no way to know what you did... |
You can append &w=1 to the commit URL to see only non-whitespace changes. |
Rather So according to what I see, you moved the AudioDevice class from private to public. How does that solve anything? |
Anyways, is there something that I can do that fixes it? If yes, please explain. Thank you very much, SFML is great and it is a pity that this bug is harassing my first game experience. |
Use this experimental branch and see if it fixes the problem (it should). It might get merged at some point, but don't hold your breath. |
Thanks for replying, can you explain to me though what exactly I need to do? Replace the files by the corresponding experimentals? |
Just download the zip and pretend you got it instead of the original SFML files. Of course you will have to build it yourself since there are no pre-compiled versions of branches. |
I don't know how to build it! I read the tutorial building with cmake but I can't do it. I have mingw and dev c++ 5.6.3 IDE |
hey manolismi, I have a working build for codeblocks and visual studio express 2013, both of wich dont have this problem if you want to switch to one ill send you one. |
binary1248, Thanks a lot!!! This branch really fixes this annoying bug!!! Can't wait to see this branch merged into master! =) |
@manolismi if you have a specific issue with cmake even after following 1:1 the tutorial and looking online for known solutions, you can ask for help on the forum (it's more appropriate there than here). |
Binary1248 I'm so grateful for your branch! Everything works! I can't thank you enough everyone, for your kindness and being helpful and supportive, even though I've spammed you a lot. |
… context management. OpenAL contexts now only exist as long as AlResources require them and are destroyed when they are no longer required. Fixes #30.
… context management. OpenAL contexts now only exist as long as AlResources require them and are destroyed when they are no longer required. Fixes #30.
… context management. OpenAL contexts now only exist as long as AlResources require them and are destroyed when they are no longer required. Fixes #30.
As binary1248 seems to have fixed the issue, is it considered resolved? |
It's in a branch that is not merged (tested) yet, so no. It will be marked as resolved after being merged into master. |
Ok. I couldn't find on which branch the commit was :) |
How much time will this take to get merged in master? |
As you see the milestone is 2.x, meaning it will happen after SFML 2.2. But why don't you use the |
That's what i'm going to do, but I'm still learning a lot in C++ basics, and had some problems using Cmake last time ( almost an afternoon to get SFML2.1 ), so i'm kind of affraid of trying it again ! EDIT: Downloaded and linked new libraries compiled from: https://github.com/LaurentGomila/SFML/tree/bugfix/al_context Some help would be greatly appreciated :) |
I've just compiled SFML from master and same problem, my programm exit with value "-1 073 741 515") |
@zedfax Please open a thread on the forum as I kinda doubt this is your issue. |
I still have the same problem on Windows 10, with dynamic linking and openal32.dll copied in the same dir with the executable.. |
Access Violation error occurs int the destructor of sf::AudioDevice on Windows XP SP3. It doesn't occur on Windows 7 and Windows Vista.
Here is the instruction pointed by the visual C++ 2008 debugger:
Code:
The error can be reproduced with this simple code :
This problem was first discussed in this post of the french forum :
http://www.sfml-dev.org/forum-fr/viewtopic.php?t=3443
The text was updated successfully, but these errors were encountered: