Skip to content

Commit

Permalink
try to fix loader test with clumsy iteration reversal
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 committed Mar 1, 2024
1 parent 5f51867 commit 717be48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions core/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,17 @@ impl<'gc> LoadManager<'gc> {
///
/// This also removes all movie loaders that have completed.
pub fn movie_clip_on_load(&mut self, queue: &mut ActionQueue<'gc>) {
let mut invalidated_loaders = vec![];
let mut loaders: Vec<_> = self.0.keys().collect();
loaders.reverse();

for (index, loader) in self.0.iter_mut() {
if loader.movie_clip_loaded(queue) {
invalidated_loaders.push(index);
}
}
loaders.retain(|handle| {
self.0
.get_mut(*handle)
.expect("valid key")
.movie_clip_loaded(queue)
});

for index in invalidated_loaders {
for index in loaders {
self.0.remove(index);
}
}
Expand Down

0 comments on commit 717be48

Please sign in to comment.