libgdx/ashley — pull request #52 by vlaaad (2014-08-28 22:08:41+00:00)
Title: Signals fix

Hi there!
First of all, ashley is a very nice framework (may be too small), and I like to play with it :)
Although, it's not ideal. I propose a change to Signal, so it will correctly handle cases of modification of listeners list while dispatching is being in progress.
There are 2 commits:

1. First adds a test case, which fails on current Signal implementation. Signal should notify every listener during dispatch, but if listener is removed when notified (which can happen very often), the next listener is skipped.
2. Second fixes failed test case :) Solution uses SnapshotArray, which freezes array during dispatch. I looked at it's source and it seems it gives very little overhead.

What do you think?