mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-02 18:17:27 +13:00
Fix shutdown race condition
This commit is contained in:
parent
b212d32d40
commit
f980fdc45a
1 changed files with 20 additions and 0 deletions
|
@ -119,6 +119,11 @@ public class StoreViewState {
|
||||||
public void onStoreAdd(DataStoreEntry... entry) {
|
public void onStoreAdd(DataStoreEntry... entry) {
|
||||||
var l = Arrays.stream(entry).map(StoreEntryWrapper::new).peek(storeEntryWrapper -> storeEntryWrapper.update()).toList();
|
var l = Arrays.stream(entry).map(StoreEntryWrapper::new).peek(storeEntryWrapper -> storeEntryWrapper.update()).toList();
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
// Don't update anything if we have already reset
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
allEntries.addAll(l);
|
allEntries.addAll(l);
|
||||||
}
|
}
|
||||||
|
@ -158,6 +163,11 @@ public class StoreViewState {
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
// Don't update anything if we have already reset
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
allEntries.removeAll(l);
|
allEntries.removeAll(l);
|
||||||
}
|
}
|
||||||
|
@ -170,6 +180,11 @@ public class StoreViewState {
|
||||||
var l = new StoreCategoryWrapper(category);
|
var l = new StoreCategoryWrapper(category);
|
||||||
l.update();
|
l.update();
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
// Don't update anything if we have already reset
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
categories.add(l);
|
categories.add(l);
|
||||||
}
|
}
|
||||||
|
@ -191,6 +206,11 @@ public class StoreViewState {
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
// Don't update anything if we have already reset
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
categories.remove(found.get());
|
categories.remove(found.get());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue