mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 08:13:18 +00:00
fix double free for model animation unloading
This commit is contained in:
@@ -60,11 +60,13 @@ namespace RAY {
|
||||
{};
|
||||
std::shared_ptr<::ModelAnimation> fetch(const std::string &path, int *counter)
|
||||
{
|
||||
::ModelAnimation *animations = this->_dataLoader(path.c_str(), counter);
|
||||
unsigned int animCount = *counter;
|
||||
|
||||
if (this->_cache.find(path) == this->_cache.end())
|
||||
this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>(
|
||||
this->_dataLoader(path.c_str(), counter), [this, counter](::ModelAnimation *p) {
|
||||
this->_dataUnloader(p, *counter);
|
||||
delete p;
|
||||
animations, [this, animCount](::ModelAnimation *p) {
|
||||
this->_dataUnloader(p, animCount);
|
||||
}));
|
||||
return _cache[path];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user