Fix issue 309: Program crashes immediately after setting ScreenScale to 1

Avoid double destroy_bitmap() call.
This commit is contained in:
David Capello 2014-02-03 00:09:42 -03:00
parent 97d1acc036
commit d3c72bedf2
2 changed files with 5 additions and 6 deletions

View File

@ -40,6 +40,8 @@ void SkinPart::clear()
{
for (Bitmaps::iterator it = m_bitmaps.begin(), end = m_bitmaps.end();
it != end; ++it) {
ASSERT(*it != NULL);
destroy_bitmap(*it);
*it = NULL;
}
@ -50,12 +52,6 @@ void SkinPart::setBitmap(size_t index, BITMAP* bitmap)
if (index >= m_bitmaps.size())
m_bitmaps.resize(index+1, NULL);
if (m_bitmaps[index] == bitmap)
return;
if (m_bitmaps[index])
destroy_bitmap(m_bitmaps[index]);
m_bitmaps[index] = bitmap;
}

View File

@ -37,7 +37,10 @@ namespace app {
size_t size() const { return m_bitmaps.size(); }
void clear();
// It doesn't destroy the previous bitmap in the given "index".
void setBitmap(size_t index, BITMAP* bitmap);
BITMAP* getBitmap(size_t index) const {
return (index < m_bitmaps.size() ? m_bitmaps[index]: NULL);
}