*Try 2: Synchronized stack alteration.

This commit is contained in:
Hellfish
2013-05-04 17:16:30 +00:00
parent 559e2b85f7
commit b31ed17ef5

View File

@@ -559,7 +559,10 @@ public class MagicStack extends MyObservable {
} }
final SpellAbilityStackInstance si = new SpellAbilityStackInstance(sp); final SpellAbilityStackInstance si = new SpellAbilityStackInstance(sp);
synchronized (this.stack) {
this.getStack().push(si); this.getStack().push(si);
}
// 2012-07-21 the following comparison needs to move below the pushes but somehow screws up priority // 2012-07-21 the following comparison needs to move below the pushes but somehow screws up priority
// When it's down there. That makes absolutely no sense to me, so i'm putting it back for now // When it's down there. That makes absolutely no sense to me, so i'm putting it back for now
@@ -844,10 +847,13 @@ public class MagicStack extends MyObservable {
* @return a {@link forge.card.spellability.SpellAbility} object. * @return a {@link forge.card.spellability.SpellAbility} object.
*/ */
public final SpellAbility pop() { public final SpellAbility pop() {
synchronized(this.stack)
{
final SpellAbilityStackInstance si = this.getStack().pop(); final SpellAbilityStackInstance si = this.getStack().pop();
final SpellAbility sp = si.getSpellAbility(); final SpellAbility sp = si.getSpellAbility();
return sp; return sp;
} }
}
public final SpellAbility top() { public final SpellAbility top() {
final SpellAbilityStackInstance si = this.getStack().peek(); final SpellAbilityStackInstance si = this.getStack().peek();