v0.6.1b: fixed rare crashes caused by floating text
This commit is contained in:
parent
d71559e0cc
commit
70cce2c8b3
|
@ -42,7 +42,7 @@ public class FloatingText extends RenderedText {
|
|||
|
||||
private float cameraZoom = -1;
|
||||
|
||||
private static SparseArray<ArrayList<FloatingText>> stacks = new SparseArray<ArrayList<FloatingText>>();
|
||||
private static final SparseArray<ArrayList<FloatingText>> stacks = new SparseArray<ArrayList<FloatingText>>();
|
||||
|
||||
public FloatingText() {
|
||||
speed.y = - DISTANCE / LIFESPAN;
|
||||
|
@ -65,7 +65,9 @@ public class FloatingText extends RenderedText {
|
|||
@Override
|
||||
public void kill() {
|
||||
if (key != -1) {
|
||||
synchronized (stacks) {
|
||||
stacks.get(key).remove(this);
|
||||
}
|
||||
key = -1;
|
||||
}
|
||||
super.kill();
|
||||
|
@ -116,6 +118,7 @@ public class FloatingText extends RenderedText {
|
|||
|
||||
private static void push( FloatingText txt, int key ) {
|
||||
|
||||
synchronized (stacks) {
|
||||
txt.key = key;
|
||||
|
||||
ArrayList<FloatingText> stack = stacks.get(key);
|
||||
|
@ -143,3 +146,4 @@ public class FloatingText extends RenderedText {
|
|||
stack.add(txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user