From de4759408309ed0bdfced774c73052a7b27cd4fc Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 28 Feb 2020 11:10:40 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=A0=D0=B0=D1=81=D1=88=D0=B8=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= =?UTF-8?q?=20NativeJVMHalt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/gravit/launcher/LauncherEngine.java | 4 ++-- .../gravit/launcher/client/ClientLauncher.java | 2 +- .../gravit/launcher/utils/NativeJVMHalt.java | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java index 301cd7b1..b7ec12c8 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java +++ b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java @@ -61,7 +61,7 @@ public static void exitLauncher(int code) modulesManager.invokeEvent(new ClientExitPhase(code)); try { System.exit(code); - } catch (Exception e) //Forge Security Manager? + } catch (Throwable e) //Forge Security Manager? { NativeJVMHalt.haltA(code); } @@ -99,7 +99,7 @@ public static void main(String... args) throws Throwable { LogHelper.debug("Launcher started in %dms", endTime - startTime); //Request.service.close(); //FunctionalBridge.close(); - SystemService.exit(0); + LauncherEngine.exitLauncher(0); } public static void initGson(ClientModuleManager modulesManager) { diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index edd47cd2..42c85934 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -301,7 +301,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl try { mainMethod.invokeWithArguments((Object) args.toArray(new String[0])); } finally { - SystemService.exit(0); + LauncherEngine.exitLauncher(0); } } diff --git a/Launcher/src/main/java/pro/gravit/launcher/utils/NativeJVMHalt.java b/Launcher/src/main/java/pro/gravit/launcher/utils/NativeJVMHalt.java index 257808d0..7b9293ec 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/utils/NativeJVMHalt.java +++ b/Launcher/src/main/java/pro/gravit/launcher/utils/NativeJVMHalt.java @@ -2,6 +2,7 @@ import pro.gravit.launcher.patches.FMLPatcher; import pro.gravit.utils.helper.JVMHelper; +import pro.gravit.utils.helper.LogHelper; import javax.swing.*; import java.awt.event.WindowEvent; @@ -22,23 +23,30 @@ private boolean aaabBooleanC_D() { } public static void haltA(int code) { + Throwable[] th = new Throwable[3]; NativeJVMHalt halt = new NativeJVMHalt(code); try { JVMHelper.RUNTIME.exit(code); - } catch (Throwable ignored) { + } catch (Throwable exitExc) { + th[0] = exitExc; try { new WindowShutdown(); - } catch (Throwable ignored1) { + } catch (Throwable windowExc) { + th[1] = windowExc; } } try { FMLPatcher.exit(code); - } catch (Throwable ignored) { + } catch (Throwable fmlExc) { + th[2] = fmlExc; + } + for(Throwable t : th) + { + if(t != null) LogHelper.error(t); } - - halt.aaabbb38C_D(); boolean a = halt.aaabBooleanC_D(); System.out.println(a); + halt.aaabbb38C_D(); }