Add new (key)frame.

Button add to stage fix.
getCharacters sync fix
This commit is contained in:
Jindra Petřík
2024-10-06 15:26:54 +02:00
parent 875b9c17d3
commit c43769410c
11 changed files with 604 additions and 113 deletions

View File

@@ -952,8 +952,10 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
* @return Character id to character map
*/
public Map<Integer, CharacterTag> getCharacters(boolean withImported) {
Map<Integer, CharacterTag> newCharacters = characters;
Map<Integer, CharacterTag> newCharactersWithImported = charactersWithImported;
synchronized (charactersLock) {
if (characters == null || charactersWithImported == null) {
if (newCharacters == null || newCharactersWithImported == null) {
if (destroyed) {
return new HashMap<>();
}
@@ -988,14 +990,16 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
}
}
characters = Collections.unmodifiableMap(chars);
charactersWithImported = Collections.unmodifiableMap(charsWithImported);
newCharacters = Collections.unmodifiableMap(chars);
newCharactersWithImported = Collections.unmodifiableMap(charsWithImported);
characters = newCharacters;
charactersWithImported = newCharactersWithImported;
characterToId = Collections.unmodifiableMap(charToId);
characterIdTags = Collections.unmodifiableMap(charIdtags);
externalImages2 = Collections.unmodifiableMap(eimages);
}
return withImported ? charactersWithImported : characters;
return withImported ? newCharactersWithImported : newCharacters;
}
}