rickomax / psxprev

PSXPREV - Playstation (PSX) Files Previewer/Extractor
BSD 2-Clause "Simplified" License
193 stars 10 forks source link

Prevent modification while enumerating All lists #59

Closed trigger-segfault closed 1 year ago

trigger-segfault commented 1 year ago

This fixes issue #58 by making sure a lock is used before enumerating over or modifying each of the three All* list types in Program.

For locking while enumerating in refreshAction, a lock is simply used in the lambda function. For locking while adding to a list, a separate function has been added to reduce code duplication.

AddEntity, AddTexture, and AddAnimation are now used as the addedAction's for all parsers. These functions handle locking the list before adding to it, and also perform the standard UpdateProgress and ReloadItems calls. The only thing this refactor changes, is that VDF and AN formats now also print the animation frame count when found (like all other parsers that support animation).