mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 10:20:48 +00:00
Fix issue 314 (crash): We were adding an image in the sprite's stock with a shared ImageBuffer
This commit is contained in:
parent
858d7ff1b3
commit
c3a03565fb
@ -221,17 +221,16 @@ void ExpandCelCanvas::commit(const gfx::Rect& bounds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_undo.pushUndoer(new undoers::ReplaceImage(m_undo.getObjects(),
|
m_undo.pushUndoer(new undoers::ReplaceImage(m_undo.getObjects(),
|
||||||
m_sprite->getStock(), m_cel->getImage()));
|
m_sprite->getStock(), m_cel->getImage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the image in the stock.
|
// Replace the image in the stock. We need to create a copy of
|
||||||
m_sprite->getStock()->replaceImage(m_cel->getImage(), m_dstImage);
|
// image because m_dstImage's ImageBuffer cannot be shared.
|
||||||
|
m_sprite->getStock()->replaceImage(m_cel->getImage(),
|
||||||
|
Image::createCopy(m_dstImage));
|
||||||
|
|
||||||
// Destroy the old cel image.
|
// Destroy the old cel image.
|
||||||
delete m_celImage;
|
delete m_celImage;
|
||||||
|
|
||||||
// Now the m_dstImage is used, so we haven't to destroy it.
|
|
||||||
m_dstImage = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_committed = true;
|
m_committed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user