Fix keeping tiles (that are removed) references into clipboard

Without this fix we can reproduce an ASSERT() fail in Object::setId()
from AddTile::onRedo() (or RemoveTile::onUndo()) doing the following
steps:

1. Creating a tilemap layer with some tiles
2. Selecting a set of tiles (in tile mode) and using "Edit > Cut"
   (this was creating a copy of the tileset with the original images)
3. Resizing tileset to 0 (to remove all tiles)
4. And then undoing (to restore all removed tiles)

The ASSERT() was because the restored tiles wanted to use the same ID
of the tile images in the clipboard.
This commit is contained in:
David Capello 2021-06-02 18:54:24 -03:00
parent 3ef3ee68e0
commit e066d45eb6

View File

@ -269,7 +269,7 @@ bool Clipboard::copyFromDocument(const Site& site, bool merged)
image,
(mask ? new Mask(*mask): nullptr),
(pal ? new Palette(*pal): nullptr),
new Tileset(*ts),
Tileset::MakeCopyCopyingImages(ts),
true, // set native clipboard
site.layer() && !site.layer()->isBackground());