Fixed leak when using images with masks

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8504 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-05-02 01:44:38 +00:00
parent 532053d319
commit f0f7167216

View File

@@ -261,8 +261,16 @@ void Material::install(bool is_full_path)
if (m_mask.size() > 0)
{
video::ITexture* tex = irr_driver->applyMask(m_texture, m_mask);
if (tex) m_texture = tex;
else fprintf(stderr, "Applying mask failed for '%s'!\n", m_texname.c_str());
if (tex)
{
irr_driver->removeTexture(m_texture);
m_texture = tex;
}
else
{
fprintf(stderr, "Applying mask failed for '%s'!\n", m_texname.c_str());
return;
}
}
m_texture->grab();
} // install