Fix spurious event-mgr warnings
- don't warn on removeTask if the event-manager was already shutdown, as happens during normal FG shutdown or reset.
This commit is contained in:
parent
3b5ed81216
commit
ed9764f923
@ -38,7 +38,8 @@ void SGTimer::run()
|
||||
(*callback)();
|
||||
}
|
||||
|
||||
SGEventMgr::SGEventMgr()
|
||||
SGEventMgr::SGEventMgr() :
|
||||
_inited(false)
|
||||
{
|
||||
|
||||
}
|
||||
@ -54,8 +55,18 @@ void SGEventMgr::unbind()
|
||||
_rtProp.clear();
|
||||
}
|
||||
|
||||
void SGEventMgr::init()
|
||||
{
|
||||
if (_inited) {
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "duplicate init of SGEventMgr");
|
||||
}
|
||||
_inited = true;
|
||||
}
|
||||
|
||||
void SGEventMgr::shutdown()
|
||||
{
|
||||
_inited = false;
|
||||
|
||||
_simQueue.clear();
|
||||
_rtQueue.clear();
|
||||
}
|
||||
@ -70,6 +81,13 @@ void SGEventMgr::update(double delta_time_sec)
|
||||
|
||||
void SGEventMgr::removeTask(const std::string& name)
|
||||
{
|
||||
// due to the ordering of the event-mgr in FG, tasks can be removed
|
||||
// after we are shutdown (and hence, have all been cleared). Guard
|
||||
// against this so we don't generate warnings below.
|
||||
if (!_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
SGTimer* t = _simQueue.findByName(name);
|
||||
if (t) {
|
||||
_simQueue.remove(t);
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
SGEventMgr();
|
||||
~SGEventMgr();
|
||||
|
||||
virtual void init() {}
|
||||
virtual void init();
|
||||
virtual void update(double delta_time_sec);
|
||||
virtual void unbind();
|
||||
virtual void shutdown();
|
||||
@ -130,6 +130,7 @@ private:
|
||||
SGPropertyNode_ptr _rtProp;
|
||||
SGTimerQueue _rtQueue;
|
||||
SGTimerQueue _simQueue;
|
||||
bool _inited;
|
||||
};
|
||||
|
||||
#endif // _SG_EVENT_MGR_HXX
|
||||
|
Loading…
Reference in New Issue
Block a user