mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Fix crash switching from a tilemap to a regular layer in tile mode & the preview window opened (fix #2854)
This commit is contained in:
parent
c46927dce6
commit
4e11d45769
@ -345,6 +345,17 @@ void Editor::setLayer(const Layer* layer)
|
||||
oldGrid = getSite().grid();
|
||||
|
||||
m_observers.notifyBeforeLayerChanged(this);
|
||||
|
||||
// Remove extra cel information if we change between different layer
|
||||
// type (e.g. from a tilemap layer to an image layer). This is
|
||||
// useful to avoid a flickering effect in the preview window (using
|
||||
// a non-updated extra cel to patch the new "layer" with the
|
||||
// background of the previous selected "m_layer".
|
||||
if ((layer == nullptr) ||
|
||||
(m_layer != nullptr && m_layer->type() != layer->type())) {
|
||||
m_document->setExtraCel(ExtraCelRef(nullptr));
|
||||
}
|
||||
|
||||
m_layer = const_cast<Layer*>(layer);
|
||||
m_observers.notifyAfterLayerChanged(this);
|
||||
|
||||
|
@ -1021,7 +1021,15 @@ void Render::renderLayer(
|
||||
m_extraImage &&
|
||||
layer == m_currentLayer &&
|
||||
((layer->isBackground() && render_background) ||
|
||||
(!layer->isBackground() && render_transparent))) {
|
||||
(!layer->isBackground() && render_transparent)) &&
|
||||
// Don't use a tilemap extra cel (IMAGE_TILEMAP) in a
|
||||
// non-tilemap layer (in the other hand tilemap layers allow
|
||||
// extra cels of any kind). This fixes a crash on renderCel()
|
||||
// when we were painting the Preview window using a tilemap
|
||||
// extra image to patch a regular layer, when switching from a
|
||||
// tilemap layer to a regular layer.
|
||||
((layer->isTilemap()) ||
|
||||
(!layer->isTilemap() && m_extraImage->pixelFormat() != IMAGE_TILEMAP))) {
|
||||
if (frame == m_extraCel->frame() &&
|
||||
frame == m_currentFrame) { // TODO this double check is not necessary
|
||||
drawExtra = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user