TestSuite: Improved memory management for the event manager.
In the initTestGlobals() helper function, the event manager is added to the subsystem manager (both created by the FGGlobals ctor). This allows the event manager to be destroyed via the subsystem manager in the FGGlobals dtor.
This commit is contained in:
parent
dbe7c90115
commit
0ea357b04c
1 changed files with 9 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <Time/TimeManager.hxx>
|
||||
|
||||
#include <simgear/structure/event_mgr.hxx>
|
||||
#include <simgear/timing/timestamp.hxx>
|
||||
|
||||
|
||||
|
@ -46,6 +47,14 @@ void initTestGlobals(const std::string& testName)
|
|||
std::unique_ptr<TimeManager> t;
|
||||
t.reset(new TimeManager);
|
||||
t->init(); // establish mag-var data
|
||||
|
||||
/**
|
||||
* Both the event manager and subsystem manager are initialised by the
|
||||
* FGGlobals ctor, but only the subsystem manager is destroyed by the dtor.
|
||||
* Here the event manager is added to the subsystem manager so it can be
|
||||
* destroyed via the subsystem manager.
|
||||
*/
|
||||
globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
|
||||
}
|
||||
|
||||
} // End of namespace setUp.
|
||||
|
|
Loading…
Reference in a new issue