The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL2_mixer shutdown takes long time
polyfrag


Joined: 24 May 2014
Posts: 30
Since I've started using SDL2_mixer, my application on Windows is taking about 15 seconds to shut down after I quit. I don't know if I can't pinpoint it. Here's my shutdown:

Code:


void Deinit()
{
   WriteProfiles(-1, 0);
   DestroyWindow(TITLE);

   // Clean up   
   
   if(g_sock)
   {
      SDLNet_UDP_Close(g_sock);
      g_sock = NULL;
   }

   FreeSounds();

   Mix_CloseAudio();

   // force a quit
   //while(Mix_Init(0))
   //   Mix_Quit();
   Mix_Quit();

   SDLNet_Quit();
   SDL_Quit();
}


void FreeSounds()
{
   for(int si=0; si<SOUNDS; si++)
   {
      Sound* s = &g_sound[si];

      if(!s->on)
         continue;

      if(s->sample)
      {
         Mix_FreeChunk(s->sample);
         s->sample = NULL;
      }

      s->on = false;
   }
}