Navigation Menu

Skip to content

Commit

Permalink
Fix exit procedure on non Windows system, fix #130
Browse files Browse the repository at this point in the history
Editor window won't exist after uncaught exception so this thread check
is not needed.
  • Loading branch information
kotcrab committed Feb 19, 2016
1 parent ab714bb commit 4c03f43
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions Editor/src/com/kotcrab/vis/editor/ui/EditorFrame.java
Expand Up @@ -35,7 +35,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Set;

/**
* VisEditor AWT/Swing based frame that holds {@link LwjglCanvas}. {@link LwjglApplication} is not used directly,
Expand All @@ -54,7 +53,7 @@ public EditorFrame (SplashController splashController, LaunchConfiguration launc
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing (WindowEvent e) {
performEditorExit();
editor.requestExit();
}
});

Expand Down Expand Up @@ -153,25 +152,6 @@ public static void main (String[] args) {
});
}

/**
* Performs editor exit, if editor is still running, this will cause to display "Do you really want to exit?" dialog in editor window.
* If editor LibGDX thread died, for example after uncaught GdxRuntimeException this will simply kill app.
*/
private void performEditorExit () {
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();

for (Thread thread : threadSet) {
if (thread.getName().contains("LWJGL Timer")) {
editor.requestExit();
return;
}
}

Log.fatal("Editor LibGDX thread is not running, performing force exit.");
Log.dispose();
System.exit(-4);
}

@Override
public void dispose () {
super.dispose();
Expand Down Expand Up @@ -212,7 +192,7 @@ public Splash (SplashController controller) {

if (controller.fatalExceptionOccurred) {
Log.fatal("Initialization error");
JOptionPane.showMessageDialog(null, "An error occurred during editor initialization, please check log: " + Log.getLogFile().parent().path());
JOptionPane.showMessageDialog(null, "An error occurred during editor initialization. Please check log");
System.exit(-5);
}

Expand Down

0 comments on commit 4c03f43

Please sign in to comment.