1
0
Fork 0

Fix some leaks on reset

- tilecache 'clear_cache' is poorly named, ensure the destructor
  really deletes all outstanding entries.
This commit is contained in:
James Turner 2014-03-13 18:18:23 +00:00
parent aaa7fca621
commit 487546c848
4 changed files with 18 additions and 2 deletions

View file

@ -100,6 +100,7 @@
#include <Navaids/navdb.hxx>
#include <Navaids/navlist.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/SceneryPager.hxx>
#include <Scenery/tilemgr.hxx>
#include <Scripting/NasalSys.hxx>
#include <Sound/voice.hxx>
@ -982,6 +983,7 @@ void fgStartNewReset()
// access the scenery object
globals->set_tile_mgr(NULL);
globals->set_scenery(NULL);
FGScenery::getPagerSingleton()->clearRequests();
flightgear::CameraGroup::setDefault(NULL);
// don't cancel the pager until after shutdown, since AIModels (and

View file

@ -42,6 +42,12 @@ SceneryPager::~SceneryPager()
{
}
void SceneryPager::clearRequests()
{
_pagerRequests.clear();
_deleteRequests.clear();
}
void SceneryPager::queueRequest(const std::string& fileName, Group* group,
float priority, FrameStamp* frameStamp,
ref_ptr<Referenced>& databaseRequest,

View file

@ -47,6 +47,8 @@ public:
// lock on the delete list.
void queueDeleteRequest(osg::ref_ptr<osg::Object>& objptr);
virtual void signalEndFrame();
void clearRequests();
protected:
// Queue up file requests until the end of the frame
struct PagerRequest

View file

@ -38,8 +38,14 @@ TileCache::TileCache( void ) :
}
TileCache::~TileCache( void ) {
clear_cache();
TileCache::~TileCache( void )
{
tile_map_iterator it = tile_cache.begin();
for (; it != tile_cache.end(); ++it) {
TileEntry* tile = it->second;
tile->removeFromSceneGraph();
delete tile;
}
}