Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5287 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Oct 6, 2005, 11:18:00 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fixed another 'BUG' inside of the deletion of the Fonts.
Now the fonts are deleted when deleting the TextEngine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine.cc

    r5285 r5287  
    812812TextEngine::~TextEngine ()
    813813{
     814  // delete all remaining fonts (this is done in the ResourceManager)
     815  tList<BaseObject>* fontList = ClassList::getList(CL_FONT);
     816  if (fontList != NULL)
     817  {
     818    tIterator<BaseObject>* fontIterator = fontList->getIterator();
     819    Font* font = dynamic_cast<Font*>(fontIterator->firstElement());
     820    while( font != NULL)
     821    {
     822      ResourceManager::getInstance()->unload(font, RP_GAME);
     823      font = dynamic_cast<Font*>(fontIterator->nextElement());
     824    }
     825    delete fontIterator;
     826  }
     827
    814828  this->disableFonts();
    815829
     
    874888void TextEngine::debug() const
    875889{
    876   PRINT(0)("+-------------------------------+\n");
    877   PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
    878   PRINT(0)("+-------------------------------+\n");
    879   PRINT(0)("Reference: %p; Text Counts: %d\n", this, ClassList::getList(CL_TEXT)->getSize());
    880 
    881   tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator();
    882   Text* text = dynamic_cast<Text*>(textIterator->firstElement());
    883   while( text != NULL)
    884     {
    885       text->debug();
    886       text = dynamic_cast<Text*>(textIterator->nextElement());
    887     }
    888   delete textIterator;
    889   PRINT(0)("+---------------------------TE--+\n");
     890  tList<BaseObject>* textList = ClassList::getList(CL_TEXT);
     891  if (textList != NULL)
     892  {
     893    PRINT(0)("+-------------------------------+\n");
     894    PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
     895    PRINT(0)("+-------------------------------+\n");
     896    PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->getSize());
     897
     898    tIterator<BaseObject>* textIterator = textList->getIterator();
     899    Text* text = dynamic_cast<Text*>(textIterator->firstElement());
     900    while( text != NULL)
     901      {
     902        text->debug();
     903        text = dynamic_cast<Text*>(textIterator->nextElement());
     904      }
     905    delete textIterator;
     906    PRINT(0)("+---------------------------TE--+\n");
     907  }
    890908}
    891909
Note: See TracChangeset for help on using the changeset viewer.