1
DotNet / AL lib: (EE) alc_cleanup: 1 device not closed
« on: July 09, 2021, 10:35:57 pm »
Hi all,
working with SMFL nuget package in .NET 5. I am experiencing 3 issues related with Sound:
1. When I close the window, the console shows this message:
AL lib: (EE) alc_cleanup: 1 device not closed
This is "not an issue" but would like to make it dissappear. I have tried using Sound.SoundBuffer.Dispose() and Sound.Dispose() when the window is closing. However, that does not seem to work in all situations. I think it mainly depends if the Sound instance belongs to the Game class (the one that has the event handler function when window is closing) or to another class (e.g., Player).
For instance, if I want to dispose Player's Sound's instance from Game's close window event handler function, it does not work (the message appears):
class Game{
...
public Player Player { get; set; }
...
private void Window_Closed(object sender, EventArgs e)
{
Player.SoundBuffer.Dispose();
Player.Sound.Dispose();
(sender as RenderWindow).Close();
}
In this same project, I have detected one exception
2. When I close the window "at the same time" the sound is going to play, an exception occurs in:
Sound.Play(); // System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
It is not easy to reproduce this exception since I need to just close the window in a very specific time (seems so).
Maybe it is trying to run Play() when the Dispose() has already been executed (becasue the window has been closed from another class)¿? API comments state that Play uses another thread so maybe it is trying to access some data already deleted.
If you have any ideas, they are welcome!
working with SMFL nuget package in .NET 5. I am experiencing 3 issues related with Sound:
1. When I close the window, the console shows this message:
AL lib: (EE) alc_cleanup: 1 device not closed
This is "not an issue" but would like to make it dissappear. I have tried using Sound.SoundBuffer.Dispose() and Sound.Dispose() when the window is closing. However, that does not seem to work in all situations. I think it mainly depends if the Sound instance belongs to the Game class (the one that has the event handler function when window is closing) or to another class (e.g., Player).
For instance, if I want to dispose Player's Sound's instance from Game's close window event handler function, it does not work (the message appears):
class Game{
...
public Player Player { get; set; }
...
private void Window_Closed(object sender, EventArgs e)
{
Player.SoundBuffer.Dispose();
Player.Sound.Dispose();
(sender as RenderWindow).Close();
}
In this same project, I have detected one exception
2. When I close the window "at the same time" the sound is going to play, an exception occurs in:
Sound.Play(); // System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
It is not easy to reproduce this exception since I need to just close the window in a very specific time (seems so).
Maybe it is trying to run Play() when the Dispose() has already been executed (becasue the window has been closed from another class)¿? API comments state that Play uses another thread so maybe it is trying to access some data already deleted.
If you have any ideas, they are welcome!