Fixed ref counting in irr_driver (file_manager was not released), added

ref counting to file system object in file manager (not strictly necessary,
but cleaner).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9968 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-10-13 01:09:23 +00:00
parent a93d05d046
commit 3b63f1c299
2 changed files with 6 additions and 4 deletions

View File

@ -148,6 +148,8 @@ void IrrDriver::initDevice()
// the problem for now. // the problem for now.
m_device->clearSystemMessages(); m_device->clearSystemMessages();
m_device->run(); m_device->run();
// Clear the pointer stored in the file manager
file_manager->dropFileSystem();
m_device->drop(); m_device->drop();
m_device = NULL; m_device = NULL;
@ -394,8 +396,6 @@ void IrrDriver::applyResolutionSettings()
m_device->clearSystemMessages(); m_device->clearSystemMessages();
m_device->run(); m_device->run();
// Clear the pointer stored in the file manager
file_manager->dropFileSystem();
delete material_manager; delete material_manager;
material_manager = NULL; material_manager = NULL;

View File

@ -128,8 +128,8 @@ FileManager::FileManager(char *argv[])
chdir( buffer ); chdir( buffer );
#endif #endif
// CHECKME HIKER: is this grabbed???
m_file_system = irr_driver->getDevice()->getFileSystem(); m_file_system = irr_driver->getDevice()->getFileSystem();
m_file_system->grab();
m_is_full_path = false; m_is_full_path = false;
irr::io::path exe_path; irr::io::path exe_path;
@ -176,6 +176,7 @@ FileManager::FileManager(char *argv[])
*/ */
void FileManager::dropFileSystem() void FileManager::dropFileSystem()
{ {
m_file_system->drop();
} // dropFileSystem } // dropFileSystem
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -185,6 +186,7 @@ void FileManager::dropFileSystem()
void FileManager::reInit() void FileManager::reInit()
{ {
m_file_system = irr_driver->getDevice()->getFileSystem(); m_file_system = irr_driver->getDevice()->getFileSystem();
m_file_system->grab();
TrackManager::addTrackSearchDir(m_root_dir+"/data/tracks"); TrackManager::addTrackSearchDir(m_root_dir+"/data/tracks");
KartPropertiesManager::addKartSearchDir(m_root_dir+"/data/karts"); KartPropertiesManager::addKartSearchDir(m_root_dir+"/data/karts");
pushTextureSearchPath(m_root_dir+"/data/textures/"); pushTextureSearchPath(m_root_dir+"/data/textures/");
@ -254,7 +256,7 @@ FileManager::~FileManager()
popMusicSearchPath(); popMusicSearchPath();
popModelSearchPath(); popModelSearchPath();
popTextureSearchPath(); popTextureSearchPath();
// m_file_system is ref-counted, so no delete/drop necessary. m_file_system->drop();
m_file_system = NULL; m_file_system = NULL;
} // ~FileManager } // ~FileManager