mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-24 17:10:19 +12:00
Make window init error handling more robust
This commit is contained in:
parent
4542225c3f
commit
5aa1c35eb1
|
@ -142,10 +142,15 @@ public class AppWindowHelper {
|
|||
if (!Platform.isFxApplicationThread()) {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
Platform.runLater(() -> {
|
||||
Alert a = supplier.get();
|
||||
c.accept(a);
|
||||
result.set(a.showAndWait());
|
||||
latch.countDown();
|
||||
try {
|
||||
Alert a = supplier.get();
|
||||
c.accept(a);
|
||||
result.set(a.showAndWait());
|
||||
} catch (Throwable t) {
|
||||
result.set(Optional.empty());
|
||||
} finally {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
latch.await();
|
||||
|
|
|
@ -106,13 +106,18 @@ public class ErrorHandlerComp extends SimpleComp {
|
|||
Platform.runLater(() -> {
|
||||
if (!showing.get()) {
|
||||
showing.set(true);
|
||||
var window = AppWindowHelper.sideWindow(
|
||||
AppI18n.get("errorHandler"),
|
||||
w -> {
|
||||
return setUpComp(event, w, finishLatch);
|
||||
},
|
||||
true,
|
||||
null);
|
||||
Stage window = null;
|
||||
try {
|
||||
window = AppWindowHelper.sideWindow(AppI18n.get("errorHandler"), w -> {
|
||||
return setUpComp(event, w, finishLatch);
|
||||
}, true, null);
|
||||
} catch (Throwable t) {
|
||||
showLatch.countDown();
|
||||
finishLatch.countDown();
|
||||
showing.set(false);
|
||||
t.printStackTrace();
|
||||
return;
|
||||
}
|
||||
// An exception is thrown when show and wait is called
|
||||
// within an animation or layout processing task, so use show
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue