Fixed a rare bug in EventDispatcher that could cause recursive dispatched events
Fixed a rare bug in EventDispatcher that could cause recursive dispatched events

The EventDispatcher class worked fine if you did not modify the list of listeners. However, after dispatching an event to a listener, if you were able to remove then add the same listener, the EventDispatcher would then dispatch the event a second time to the same listener, causing a loop.

Instead of dispatching events while there are still listeners in the list, I have changed it to check the length before-hand, and to only handle that many listeners. This will ignore new listeners while in the loop.

git-svn-id: 6cc2fa9b7d2830c930c171b991ffcd5e23f23d5e@1160 1509560c-5e2a-0410-865c-31c25e1cfdef

thomasuster/NME,haxenme/nme,thomasuster/NME,madrazo/nme,madrazo/nme,haxenme/nme,thomasuster/NME,madrazo/nme,thomasuster/NME,thomasuster/NME,madrazo/nme,haxenme/nme,thomasuster/NME,haxenme/nme,haxenme/nme,madrazo/nme,madrazo/nme