mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 01:20:17 +00:00
Fix issue 309: Program crashes immediately after setting ScreenScale to 1
Avoid double destroy_bitmap() call.
This commit is contained in:
parent
97d1acc036
commit
d3c72bedf2
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user