mirror of
https://github.com/minetest/minetest.git
synced 2024-11-29 19:13:44 +01:00
Android: Fix memory leak when displaying images in the mainmenu (#8011)
This commit is contained in:
parent
a873a3f4f8
commit
ce4497224f
@ -89,20 +89,28 @@ video::ITexture* MenuTextureSource::getTexture(const std::string &name, u32 *id)
|
||||
{
|
||||
if (id)
|
||||
*id = 0;
|
||||
|
||||
if (name.empty())
|
||||
return NULL;
|
||||
|
||||
m_to_delete.insert(name);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
video::ITexture *retval = m_driver->findTexture(name.c_str());
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
video::IImage *image = m_driver->createImageFromFile(name.c_str());
|
||||
if (image) {
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
image = Align2Npot2(image, m_driver);
|
||||
video::ITexture* retval = m_driver->addTexture(name.c_str(), image);
|
||||
retval = m_driver->addTexture(name.c_str(), image);
|
||||
image->drop();
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
return m_driver->getTexture(name.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user