Skip to content

Commit

Permalink
Add synchronization for trains window
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBoudreau committed Oct 7, 2018
1 parent a9039f1 commit 0a41b52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions java/src/jmri/jmrit/operations/trains/TrainsTableModel.java
Expand Up @@ -88,17 +88,19 @@ private void updateList() {
// first, remove listeners from the individual objects
removePropertyChangeTrains();

if (_sort == SORTBYID) {
sysList = trainManager.getTrainsByIdList();
} else {
sysList = trainManager.getTrainsByTimeList();
}
synchronized (sysList) {
if (_sort == SORTBYID) {
sysList = trainManager.getTrainsByIdList();
} else {
sysList = trainManager.getTrainsByTimeList();
}

if (!isShowAll()) {
// filter out trains not checked
for (int i = sysList.size() - 1; i >= 0; i--) {
if (!sysList.get(i).isBuildEnabled()) {
sysList.remove(i);
if (!isShowAll()) {
// filter out trains not checked
for (int i = sysList.size() - 1; i >= 0; i--) {
if (!sysList.get(i).isBuildEnabled()) {
sysList.remove(i);
}
}
}
}
Expand All @@ -107,7 +109,7 @@ private void updateList() {
addPropertyChangeTrains();
}

List<Train> sysList = null;
List<Train> sysList = trainManager.getTrainsByTimeList();
JTable _table = null;
TrainsTableFrame _frame = null;

Expand Down
Expand Up @@ -198,7 +198,7 @@ public boolean waitForProcessToComplete() throws InterruptedException {
log.debug("Waiting for Excel program to complete");
status = process.waitFor(waitTimeSeconds, TimeUnit.SECONDS);
if (file.exists()) {
log.error("Common file not deleted!");
log.error("Common file ({}) not deleted!", file.getPath());
return false;
}
log.debug("Excel program complete!");
Expand Down

0 comments on commit 0a41b52

Please sign in to comment.