mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Fix crash when PixelsMovement() wants to create an extra cel without enough memory
This commit is contained in:
parent
43a0279a24
commit
849e40b0f9
@ -278,19 +278,19 @@ void Document::prepareExtraCel(const gfx::Rect& bounds, int opacity)
|
|||||||
{
|
{
|
||||||
ASSERT(sprite() != NULL);
|
ASSERT(sprite() != NULL);
|
||||||
|
|
||||||
|
if (!m_extraImage ||
|
||||||
|
m_extraImage->pixelFormat() != sprite()->pixelFormat() ||
|
||||||
|
m_extraImage->width() != bounds.w ||
|
||||||
|
m_extraImage->height() != bounds.h) {
|
||||||
|
Image* newImage = Image::create(sprite()->pixelFormat(), bounds.w, bounds.h);
|
||||||
|
m_extraImage.reset(newImage);
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_extraCel)
|
if (!m_extraCel)
|
||||||
m_extraCel = new Cel(frame_t(0), ImageRef(NULL)); // Ignored fields for this cel (frame, and image index)
|
m_extraCel = new Cel(frame_t(0), ImageRef(NULL)); // Ignored fields for this cel (frame, and image index)
|
||||||
|
|
||||||
m_extraCel->setPosition(bounds.getOrigin());
|
m_extraCel->setPosition(bounds.getOrigin());
|
||||||
m_extraCel->setOpacity(opacity);
|
m_extraCel->setOpacity(opacity);
|
||||||
|
|
||||||
if (!m_extraImage ||
|
|
||||||
m_extraImage->pixelFormat() != sprite()->pixelFormat() ||
|
|
||||||
m_extraImage->width() != bounds.w ||
|
|
||||||
m_extraImage->height() != bounds.h) {
|
|
||||||
m_extraImage.reset(Image::create(sprite()->pixelFormat(),
|
|
||||||
bounds.w, bounds.h));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cel* Document::getExtraCel() const
|
Cel* Document::getExtraCel() const
|
||||||
|
@ -440,6 +440,10 @@ void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleT
|
|||||||
StatusBar::instance()->showTip(1000, "The sprite is locked in other editor");
|
StatusBar::instance()->showTip(1000, "The sprite is locked in other editor");
|
||||||
ui::set_mouse_cursor(kForbiddenCursor);
|
ui::set_mouse_cursor(kForbiddenCursor);
|
||||||
}
|
}
|
||||||
|
catch (const std::bad_alloc&) {
|
||||||
|
StatusBar::instance()->showTip(1000, "Not enough memory to transform the selection");
|
||||||
|
ui::set_mouse_cursor(kForbiddenCursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandbyState::callEyedropper(Editor* editor)
|
void StandbyState::callEyedropper(Editor* editor)
|
||||||
|
Loading…
Reference in New Issue
Block a user