Ticket #577: diff-bug-snd_mgr-20-03-2011-alt.patch

File diff-bug-snd_mgr-20-03-2011-alt.patch, 1023 bytes (added by Badmadblacksad, 13 years ago)

alt 2

  • source/lib/res/sound/snd_mgr.cpp

     
    482482    debug_assert(0);    // list full (can't happen)
    483483}
    484484
    485 static void srcs_remove(volatile intptr_t* srcs, ALuint al_src)
     485static bool srcs_remove(volatile intptr_t* srcs, ALuint al_src)
    486486{
    487487    for(size_t i = 0; i < al_src_allocated; i++)
    488488    {
    489489        if(cpu_CAS(&srcs[i], (intptr_t)al_src, 0))
    490             return;
     490            return true;
    491491    }
    492     debug_assert(0);    // source not found (can't happen)
     492    return false;
     493    //debug_assert(0);  // source not found (can't happen)
    493494}
    494495
    495496// @return first nonzero entry (which is then zeroed), or zero if there are none.
     
    585586static void al_src_free(ALuint al_src)
    586587{
    587588    debug_assert(alIsSource(al_src));
    588     srcs_remove(al_srcs_used, al_src);
    589     srcs_insert(al_srcs_free, al_src);
     589    if (srcs_remove(al_srcs_used, al_src))
     590        srcs_insert(al_srcs_free, al_src);
    590591}
    591592
    592593