Skip to content

Commit

Permalink
Try to avoid leaks in the SoundEffect FAudio context
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jan 2, 2025
1 parent 8fb847d commit d90a2ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FNAPlatform/SDL2_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ public static void ProgramExit(object sender, EventArgs e)

if (SoundEffect.FAudioContext.Context != null)
{
GC.Collect(); // Desperate last bid to collect SoundEffectInstances

SoundEffect.FAudioContext.Context.Dispose();
}
Media.MediaPlayer.DisposeIfNecessary();
Expand Down
2 changes: 2 additions & 0 deletions src/FNAPlatform/SDL3_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public static void ProgramExit(object sender, EventArgs e)

if (SoundEffect.FAudioContext.Context != null)
{
GC.Collect(); // Desperate last bid to collect SoundEffectInstances

SoundEffect.FAudioContext.Context.Dispose();
}
Media.MediaPlayer.DisposeIfNecessary();
Expand Down

0 comments on commit d90a2ca

Please sign in to comment.