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:
David Capello 2019-04-01 15:50:59 -03:00
parent ed0f4c3023
commit 29a4c6f744

View File

@ -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();