v3.0.1: improved sync checks in game log
This commit is contained in:
@@ -54,6 +54,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void update() {
|
public synchronized void update() {
|
||||||
|
|
||||||
|
synchronized (textsToAdd){
|
||||||
if (!textsToAdd.isEmpty()){
|
if (!textsToAdd.isEmpty()){
|
||||||
int maxLines = SPDSettings.interfaceSize() > 0 ? 5 : 3;
|
int maxLines = SPDSettings.interfaceSize() > 0 ? 5 : 3;
|
||||||
for (String text : textsToAdd){
|
for (String text : textsToAdd){
|
||||||
@@ -128,6 +129,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
|||||||
layout();
|
layout();
|
||||||
textsToAdd.clear();
|
textsToAdd.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
super.update();
|
super.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,8 +146,10 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean onSignal( String text ) {
|
public boolean onSignal( String text ) {
|
||||||
|
synchronized (textsToAdd) {
|
||||||
textsToAdd.add(text);
|
textsToAdd.add(text);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +175,9 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void wipe() {
|
public static void wipe() {
|
||||||
|
synchronized (textsToAdd) {
|
||||||
entries.clear();
|
entries.clear();
|
||||||
textsToAdd.clear();
|
textsToAdd.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user