mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-26 17:37:07 +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_sprite->getStock(), m_cel->getImage()));
|
||||
m_sprite->getStock(), m_cel->getImage()));
|
||||
}
|
||||
|
||||
// Replace the image in the stock.
|
||||
m_sprite->getStock()->replaceImage(m_cel->getImage(), m_dstImage);
|
||||
// Replace the image in the stock. We need to create a copy of
|
||||
// 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.
|
||||
delete m_celImage;
|
||||
|
||||
// Now the m_dstImage is used, so we haven't to destroy it.
|
||||
m_dstImage = NULL;
|
||||
}
|
||||
|
||||
m_committed = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user