Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5895


Ignore:
Timestamp:
Oct 6, 2009, 9:42:58 PM (15 years ago)
Author:
landauf
Message:

Attempt to fix a crash when switching from a level back to the mainmenu

Location:
code/branches/core5/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc

    r5831 r5895  
    5858    ChatOverlay::~ChatOverlay()
    5959    {
     60        for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)
     61            delete (*it);
    6062    }
    6163
     
    8789        COUT(0) << "Chat: " << text << std::endl;
    8890
    89         new Timer(this->displayTime_, false, createExecutor(createFunctor(&ChatOverlay::dropMessage, this)), true);
     91        Timer* timer = new Timer();
     92        this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
     93        Executor* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
     94        executor->setDefaultValues(timer);
     95        timer->setTimer(this->displayTime_, false, executor, true);
    9096
    9197        this->updateOverlayText();
    9298    }
    9399
    94     void ChatOverlay::dropMessage()
     100    void ChatOverlay::dropMessage(Timer* timer)
    95101    {
    96102        if (this->messages_.size() > 0)
    97103            this->messages_.pop_front();
    98104        this->updateOverlayText();
     105        this->timers_.erase(timer); // the timer destroys itself, but we have to remove it from the set
    99106    }
    100107
  • code/branches/core5/src/modules/overlays/hud/ChatOverlay.h

    r5738 r5895  
    5555        private:
    5656            void updateOverlayText();
    57             void dropMessage();
     57            void dropMessage(Timer* timer);
    5858
    5959            float displayTime_;
     60            std::set<Timer*> timers_;
    6061    };
    6162}
  • code/branches/core5/src/orxonox/OrxonoxPrereqs.h

    r5862 r5895  
    3737
    3838#include "OrxonoxConfig.h"
     39#include "tools/ToolsPrereqs.h"
    3940
    4041//-----------------------------------------------------------------------
  • code/branches/core5/src/orxonox/graphics/ParticleEmitter.h

    r5858 r5895  
    3434#include <string>
    3535#include "worldentities/StaticEntity.h"
    36 #include "tools/ToolsPrereqs.h"
    3736
    3837namespace orxonox
  • code/branches/core5/src/orxonox/interfaces/RadarViewable.h

    r5858 r5895  
    3838#include "util/OgreForwardRefs.h"
    3939#include "core/OrxonoxClass.h"
    40 #include "tools/ToolsPrereqs.h"
    4140
    4241namespace orxonox
Note: See TracChangeset for help on using the changeset viewer.