[Orxonox-commit 1174] r5895 - in code/branches/core5/src: modules/overlays/hud orxonox orxonox/graphics orxonox/interfaces
landauf at orxonox.net
landauf at orxonox.net
Tue Oct 6 21:42:58 CEST 2009
Author: landauf
Date: 2009-10-06 21:42:58 +0200 (Tue, 06 Oct 2009)
New Revision: 5895
Modified:
code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc
code/branches/core5/src/modules/overlays/hud/ChatOverlay.h
code/branches/core5/src/orxonox/OrxonoxPrereqs.h
code/branches/core5/src/orxonox/graphics/ParticleEmitter.h
code/branches/core5/src/orxonox/interfaces/RadarViewable.h
Log:
Attempt to fix a crash when switching from a level back to the mainmenu
Modified: code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc 2009-10-06 16:58:10 UTC (rev 5894)
+++ code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc 2009-10-06 19:42:58 UTC (rev 5895)
@@ -57,6 +57,8 @@
ChatOverlay::~ChatOverlay()
{
+ for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)
+ delete (*it);
}
void ChatOverlay::setConfigValues()
@@ -86,16 +88,21 @@
this->messages_.push_back(multi_cast<Ogre::UTFString>(text));
COUT(0) << "Chat: " << text << std::endl;
- new Timer(this->displayTime_, false, createExecutor(createFunctor(&ChatOverlay::dropMessage, this)), true);
+ Timer* timer = new Timer();
+ this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
+ Executor* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
+ executor->setDefaultValues(timer);
+ timer->setTimer(this->displayTime_, false, executor, true);
this->updateOverlayText();
}
- void ChatOverlay::dropMessage()
+ void ChatOverlay::dropMessage(Timer* timer)
{
if (this->messages_.size() > 0)
this->messages_.pop_front();
this->updateOverlayText();
+ this->timers_.erase(timer); // the timer destroys itself, but we have to remove it from the set
}
void ChatOverlay::updateOverlayText()
Modified: code/branches/core5/src/modules/overlays/hud/ChatOverlay.h
===================================================================
--- code/branches/core5/src/modules/overlays/hud/ChatOverlay.h 2009-10-06 16:58:10 UTC (rev 5894)
+++ code/branches/core5/src/modules/overlays/hud/ChatOverlay.h 2009-10-06 19:42:58 UTC (rev 5895)
@@ -54,9 +54,10 @@
private:
void updateOverlayText();
- void dropMessage();
+ void dropMessage(Timer* timer);
float displayTime_;
+ std::set<Timer*> timers_;
};
}
#endif /* _DebugFPSText_H__ */
Modified: code/branches/core5/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/core5/src/orxonox/OrxonoxPrereqs.h 2009-10-06 16:58:10 UTC (rev 5894)
+++ code/branches/core5/src/orxonox/OrxonoxPrereqs.h 2009-10-06 19:42:58 UTC (rev 5895)
@@ -36,6 +36,7 @@
#define _OrxonoxPrereqs_H__
#include "OrxonoxConfig.h"
+#include "tools/ToolsPrereqs.h"
//-----------------------------------------------------------------------
// Shared library settings
Modified: code/branches/core5/src/orxonox/graphics/ParticleEmitter.h
===================================================================
--- code/branches/core5/src/orxonox/graphics/ParticleEmitter.h 2009-10-06 16:58:10 UTC (rev 5894)
+++ code/branches/core5/src/orxonox/graphics/ParticleEmitter.h 2009-10-06 19:42:58 UTC (rev 5895)
@@ -33,7 +33,6 @@
#include <string>
#include "worldentities/StaticEntity.h"
-#include "tools/ToolsPrereqs.h"
namespace orxonox
{
Modified: code/branches/core5/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/branches/core5/src/orxonox/interfaces/RadarViewable.h 2009-10-06 16:58:10 UTC (rev 5894)
+++ code/branches/core5/src/orxonox/interfaces/RadarViewable.h 2009-10-06 19:42:58 UTC (rev 5895)
@@ -37,7 +37,6 @@
#include "util/Math.h"
#include "util/OgreForwardRefs.h"
#include "core/OrxonoxClass.h"
-#include "tools/ToolsPrereqs.h"
namespace orxonox
{
More information about the Orxonox-commit
mailing list