mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -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();
|
GameWindow.prepare();
|
||||||
progress.countDown();
|
progress.countDown();
|
||||||
|
|
||||||
}, "Game Window", "", Priorities.NORMAL, TaskImportance.REQUIRED, "Assets"));
|
}, "Game Window", "", Priorities.NORMAL, TaskImportance.REQUIRED, "Assets", "Progress Window"));
|
||||||
|
|
||||||
taskWorker.work(startStatusLatch);
|
taskWorker.work(startStatusLatch);
|
||||||
try {
|
try {
|
||||||
|
@ -98,14 +98,6 @@ public class AssetsManager {
|
|||||||
e.printStackTrace();
|
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();
|
generateJarAssets();
|
||||||
assets.putAll(parseAssetsIndex(ASSETS_CLIENT_JAR_HASH));
|
assets.putAll(parseAssetsIndex(ASSETS_CLIENT_JAR_HASH));
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
|
@ -34,12 +34,14 @@ public class StartProgressWindow extends Application {
|
|||||||
public static Dialog<Boolean> progressDialog;
|
public static Dialog<Boolean> progressDialog;
|
||||||
private static boolean exit = false;
|
private static boolean exit = false;
|
||||||
|
|
||||||
public static void show(CountUpAndDownLatch progress) {
|
public static void show(CountUpAndDownLatch progress) throws InterruptedException {
|
||||||
if (exit) {
|
if (exit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
if (progress.getCount() == 0) {
|
if (progress.getCount() == 0) {
|
||||||
|
latch.countDown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AtomicReference<ProgressBar> progressBar = new AtomicReference<>();
|
AtomicReference<ProgressBar> progressBar = new AtomicReference<>();
|
||||||
@ -59,11 +61,13 @@ public class StartProgressWindow extends Application {
|
|||||||
stage.initModality(Modality.APPLICATION_MODAL);
|
stage.initModality(Modality.APPLICATION_MODAL);
|
||||||
stage.setOnCloseRequest((request) -> System.exit(0));
|
stage.setOnCloseRequest((request) -> System.exit(0));
|
||||||
if (exit) {
|
if (exit) {
|
||||||
|
latch.countDown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
stage.toFront();
|
stage.toFront();
|
||||||
});
|
});
|
||||||
|
latch.countDown();
|
||||||
while (progress.getCount() > 0) {
|
while (progress.getCount() > 0) {
|
||||||
try {
|
try {
|
||||||
progress.waitForChange();
|
progress.waitForChange();
|
||||||
@ -77,6 +81,7 @@ public class StartProgressWindow extends Application {
|
|||||||
}
|
}
|
||||||
hideDialog();
|
hideDialog();
|
||||||
}).start();
|
}).start();
|
||||||
|
latch.await();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start() throws InterruptedException {
|
public static void start() throws InterruptedException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user