[FIX] Расширенная обработка ошибок NativeJVMHalt

This commit is contained in:
Gravit 2020-02-28 11:10:40 +07:00
parent ec5c076a16
commit de47594083
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 16 additions and 8 deletions

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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();
}