in loadScene Fuction , missing ' file->drop(); '
it cause memory leak
i added file->drop();' after 'SceneLoaderList->loadScene(file, userDataSerializer, rootNode);'
Code: Select all
bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode)
{
bool ret = false;
io::IReadFile* file = FileSystem->createAndOpenFile(filename);
if (!file)
{
os::Printer::log("Unable to open scene file", filename.c_str(), ELL_ERROR);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
// try scene loaders in reverse order
s32 i = SceneLoaderList.size()-1;
for (; i >= 0 && !ret; --i)
if (SceneLoaderList[i]->isALoadableFileExtension(filename))
{
ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);
file->drop(); // <-- may be it need?
}
if (!ret)
os::Printer::log("Could not load scene file, perhaps the format is unsupported: ", filename.c_str(), ELL_ERROR);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return ret;
}