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