mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add texture refcounting grab/drop to MenuTextureSource
This commit is contained in:
parent
fa0c09d202
commit
8fd2a8773e
1 changed files with 4 additions and 1 deletions
|
@ -53,6 +53,7 @@ MenuTextureSource::~MenuTextureSource()
|
||||||
|
|
||||||
for (const auto &it: m_to_delete) {
|
for (const auto &it: m_to_delete) {
|
||||||
m_driver->removeTexture(it);
|
m_driver->removeTexture(it);
|
||||||
|
it->drop();
|
||||||
}
|
}
|
||||||
m_to_delete.clear();
|
m_to_delete.clear();
|
||||||
|
|
||||||
|
@ -82,8 +83,10 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
|
||||||
retval = m_driver->addTexture(name.c_str(), image);
|
retval = m_driver->addTexture(name.c_str(), image);
|
||||||
image->drop();
|
image->drop();
|
||||||
|
|
||||||
if (retval)
|
if (retval) {
|
||||||
|
retval->grab();
|
||||||
m_to_delete.push_back(retval);
|
m_to_delete.push_back(retval);
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue