mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-17 08:43:11 +00:00
Fix accessing to invalid Site object after undoing/redoing
Mainly the site.layer() field of the context writer after an undo/redo is not valid anymore (e.g. because the layer could have been removed). Now we get the new active site (Context::activeSite()) to go to that place after the undo/redo operation.
This commit is contained in:
parent
ed0f4c3023
commit
29a4c6f744
@ -130,9 +130,10 @@ void UndoCommand::onExecute(Context* context)
|
||||
// (because new frames/layers could be added, positions that we
|
||||
// weren't able to reach before the undo).
|
||||
if (gotoModified) {
|
||||
Site newSite = context->activeSite();
|
||||
SpritePosition currentPosition(
|
||||
writer.site()->layer(),
|
||||
writer.site()->frame());
|
||||
newSite.layer(),
|
||||
newSite.frame());
|
||||
|
||||
if (spritePosition != currentPosition) {
|
||||
Layer* selectLayer = spritePosition.layer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user