mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
render: (hopefully) fix SIGSEGV jvm crash
It looks like that the jvm crashes when preparing the render window while JavaFX is launching an window. Weired.
This commit is contained in:
parent
687410bc31
commit
445643f23d
@ -164,7 +164,7 @@ public final class Minosoft {
|
||||
GameWindow.prepare();
|
||||
progress.countDown();
|
||||
|
||||
}, "Game Window", "", Priorities.NORMAL, TaskImportance.REQUIRED, "Assets"));
|
||||
}, "Game Window", "", Priorities.NORMAL, TaskImportance.REQUIRED, "Assets", "Progress Window"));
|
||||
|
||||
taskWorker.work(startStatusLatch);
|
||||
try {
|
||||
|
@ -98,14 +98,6 @@ public class AssetsManager {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
// ToDo: This is strange. You will get a jvm crash without it on linux. Weired.
|
||||
/*
|
||||
try {
|
||||
Thread.sleep(500L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
generateJarAssets();
|
||||
assets.putAll(parseAssetsIndex(ASSETS_CLIENT_JAR_HASH));
|
||||
latch.countDown();
|
||||
|
@ -34,12 +34,14 @@ public class StartProgressWindow extends Application {
|
||||
public static Dialog<Boolean> progressDialog;
|
||||
private static boolean exit = false;
|
||||
|
||||
public static void show(CountUpAndDownLatch progress) {
|
||||
public static void show(CountUpAndDownLatch progress) throws InterruptedException {
|
||||
if (exit) {
|
||||
return;
|
||||
}
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
new Thread(() -> {
|
||||
if (progress.getCount() == 0) {
|
||||
latch.countDown();
|
||||
return;
|
||||
}
|
||||
AtomicReference<ProgressBar> progressBar = new AtomicReference<>();
|
||||
@ -59,11 +61,13 @@ public class StartProgressWindow extends Application {
|
||||
stage.initModality(Modality.APPLICATION_MODAL);
|
||||
stage.setOnCloseRequest((request) -> System.exit(0));
|
||||
if (exit) {
|
||||
latch.countDown();
|
||||
return;
|
||||
}
|
||||
progressDialog.show();
|
||||
stage.toFront();
|
||||
});
|
||||
latch.countDown();
|
||||
while (progress.getCount() > 0) {
|
||||
try {
|
||||
progress.waitForChange();
|
||||
@ -77,6 +81,7 @@ public class StartProgressWindow extends Application {
|
||||
}
|
||||
hideDialog();
|
||||
}).start();
|
||||
latch.await();
|
||||
}
|
||||
|
||||
public static void start() throws InterruptedException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user