Fix some leaks on reset
- tilecache 'clear_cache' is poorly named, ensure the destructor really deletes all outstanding entries.
This commit is contained in:
parent
aaa7fca621
commit
487546c848
4 changed files with 18 additions and 2 deletions
|
@ -100,6 +100,7 @@
|
||||||
#include <Navaids/navdb.hxx>
|
#include <Navaids/navdb.hxx>
|
||||||
#include <Navaids/navlist.hxx>
|
#include <Navaids/navlist.hxx>
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
|
#include <Scenery/SceneryPager.hxx>
|
||||||
#include <Scenery/tilemgr.hxx>
|
#include <Scenery/tilemgr.hxx>
|
||||||
#include <Scripting/NasalSys.hxx>
|
#include <Scripting/NasalSys.hxx>
|
||||||
#include <Sound/voice.hxx>
|
#include <Sound/voice.hxx>
|
||||||
|
@ -982,6 +983,7 @@ void fgStartNewReset()
|
||||||
// access the scenery object
|
// access the scenery object
|
||||||
globals->set_tile_mgr(NULL);
|
globals->set_tile_mgr(NULL);
|
||||||
globals->set_scenery(NULL);
|
globals->set_scenery(NULL);
|
||||||
|
FGScenery::getPagerSingleton()->clearRequests();
|
||||||
flightgear::CameraGroup::setDefault(NULL);
|
flightgear::CameraGroup::setDefault(NULL);
|
||||||
|
|
||||||
// don't cancel the pager until after shutdown, since AIModels (and
|
// don't cancel the pager until after shutdown, since AIModels (and
|
||||||
|
|
|
@ -42,6 +42,12 @@ SceneryPager::~SceneryPager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneryPager::clearRequests()
|
||||||
|
{
|
||||||
|
_pagerRequests.clear();
|
||||||
|
_deleteRequests.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void SceneryPager::queueRequest(const std::string& fileName, Group* group,
|
void SceneryPager::queueRequest(const std::string& fileName, Group* group,
|
||||||
float priority, FrameStamp* frameStamp,
|
float priority, FrameStamp* frameStamp,
|
||||||
ref_ptr<Referenced>& databaseRequest,
|
ref_ptr<Referenced>& databaseRequest,
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
// lock on the delete list.
|
// lock on the delete list.
|
||||||
void queueDeleteRequest(osg::ref_ptr<osg::Object>& objptr);
|
void queueDeleteRequest(osg::ref_ptr<osg::Object>& objptr);
|
||||||
virtual void signalEndFrame();
|
virtual void signalEndFrame();
|
||||||
|
|
||||||
|
void clearRequests();
|
||||||
protected:
|
protected:
|
||||||
// Queue up file requests until the end of the frame
|
// Queue up file requests until the end of the frame
|
||||||
struct PagerRequest
|
struct PagerRequest
|
||||||
|
|
|
@ -38,8 +38,14 @@ TileCache::TileCache( void ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TileCache::~TileCache( void ) {
|
TileCache::~TileCache( void )
|
||||||
clear_cache();
|
{
|
||||||
|
tile_map_iterator it = tile_cache.begin();
|
||||||
|
for (; it != tile_cache.end(); ++it) {
|
||||||
|
TileEntry* tile = it->second;
|
||||||
|
tile->removeFromSceneGraph();
|
||||||
|
delete tile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue