소스 검색

Fixed Skeleton Viewer process staying alive after a crash.

NathanSweet 9 년 전
부모
커밋
88207a609c
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java

+ 8 - 0
spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java

@@ -36,6 +36,7 @@ import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
 import java.awt.FileDialog;
 import java.awt.Frame;
 import java.io.File;
+import java.lang.Thread.UncaughtExceptionHandler;
 
 import com.badlogic.gdx.ApplicationAdapter;
 import com.badlogic.gdx.Gdx;
@@ -95,6 +96,13 @@ public class SkeletonViewer extends ApplicationAdapter {
 	float lastModifiedCheck, reloadTimer;
 
 	public void create () {
+		Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+			public void uncaughtException (Thread thread, Throwable ex) {
+				ex.printStackTrace();
+				Runtime.getRuntime().halt(0); // Prevent Swing from keeping JVM alive.
+			}
+		});
+
 		ui = new UI();
 		batch = new PolygonSpriteBatch();
 		renderer = new SkeletonMeshRenderer();