Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 20, 2005, 2:41:21 PM (19 years ago)
Author:
bensch
Message:

christmas: clean delete again (backward deletion)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/christmas_branche/src/util/loading/resource_manager.cc

    r6186 r6189  
    577577{
    578578  std::list<Resource*>::iterator resource, pre;
    579   pre = this->resourceList.begin();
    580   while (pre != resourceList.end())
     579  pre = --this->resourceList.end();
     580  unsigned int removeCount;
     581  for (unsigned int round = 0; round < 3; round++)
    581582  {
    582     resource = pre;
    583     pre++;
    584       if ((*resource)->prio <= prio)
    585         if ((*resource)->count == 0)
    586           unload((*resource), prio);
    587         else
    588           PRINTF(2)("unable to unload %s because there are still %d references to it\n",
    589                    (*resource)->name, (*resource)->count);
    590     }
     583    removeCount = 0;
     584    while (pre != resourceList.end())
     585    {
     586      resource = pre;
     587      pre--;
     588        if ((*resource)->prio <= prio)
     589        {
     590          if ((*resource)->count == 0)
     591            unload((*resource), prio);
     592          else
     593          {
     594            PRINTF(2)("unable to unload %s because there are still %d references to it\n",
     595                     (*resource)->name, (*resource)->count);
     596            removeCount++;
     597          }
     598        }
     599     }
     600     if (removeCount == 0) break;
     601  }
    591602}
    592603
Note: See TracChangeset for help on using the changeset viewer.