This changes Effect#activate and Effect#deactivate such that the Effect's active property is set to the proper value before their corresponding events are emitted. Most importantly, this prevents a case where an infinite loop might be created.
In this case, EffectList#validateEffects and the listener function will be stuck invoking one another until the stack overflows. While less likely to occur practice, we could engineer a similar loop with Effect#activate and its related event.
Setting the active property before any events are called ensures that each method will short-circuit before this becomes an issue.
This changes
Effect#activate
andEffect#deactivate
such that the Effect'sactive
property is set to the proper value before their corresponding events are emitted. Most importantly, this prevents a case where an infinite loop might be created.Example (some debugEffect.js):
In this case,
EffectList#validateEffects
and the listener function will be stuck invoking one another until the stack overflows. While less likely to occur practice, we could engineer a similar loop withEffect#activate
and its related event.Setting the
active
property before any events are called ensures that each method will short-circuit before this becomes an issue.