From 6009e81197831043c3a0bb66fda6a11137a9ef12 Mon Sep 17 00:00:00 2001 From: Ryan Dowling Date: Thu, 6 Jul 2023 19:38:16 +1000 Subject: [PATCH] fix: explicitely end session when using System.exit --- src/main/java/com/atlauncher/Launcher.java | 2 ++ src/main/java/com/atlauncher/data/Instance.java | 2 ++ src/main/java/com/atlauncher/data/Server.java | 1 + src/main/java/com/atlauncher/gui/SplashScreen.java | 2 ++ src/main/java/com/atlauncher/gui/TrayMenu.java | 1 + src/main/java/com/atlauncher/utils/OS.java | 1 + 6 files changed, 9 insertions(+) diff --git a/src/main/java/com/atlauncher/Launcher.java b/src/main/java/com/atlauncher/Launcher.java index 6a73806f..de8210d2 100644 --- a/src/main/java/com/atlauncher/Launcher.java +++ b/src/main/java/com/atlauncher/Launcher.java @@ -247,6 +247,7 @@ public class Launcher { LogManager.logStackTrace(e); } + Analytics.endSession(); System.exit(0); } @@ -418,6 +419,7 @@ public class Launcher { .build()) .setType(DialogManager.ERROR).show(); OS.openWebBrowser("https://atlauncher.com/downloads"); + Analytics.endSession(); System.exit(0); } } diff --git a/src/main/java/com/atlauncher/data/Instance.java b/src/main/java/com/atlauncher/data/Instance.java index 583d629b..f0184adf 100644 --- a/src/main/java/com/atlauncher/data/Instance.java +++ b/src/main/java/com/atlauncher/data/Instance.java @@ -1115,6 +1115,7 @@ public class Instance extends MinecraftVersion { if ((App.autoLaunch != null && App.closeLauncher) || (!App.settings.keepLauncherOpen && !App.settings.enableLogs)) { + Analytics.endSession(); System.exit(0); } @@ -1297,6 +1298,7 @@ public class Instance extends MinecraftVersion { FileUtils.delete(getCustomMinecraftJarLibraryPath()); } if (!App.settings.keepLauncherOpen) { + Analytics.endSession(); System.exit(0); } } catch (Exception e1) { diff --git a/src/main/java/com/atlauncher/data/Server.java b/src/main/java/com/atlauncher/data/Server.java index c042b7b7..b2a66908 100644 --- a/src/main/java/com/atlauncher/data/Server.java +++ b/src/main/java/com/atlauncher/data/Server.java @@ -243,6 +243,7 @@ public class Server { .build()) .setType(DialogManager.INFO).show(); } else { + Analytics.endSession(); System.exit(0); } } catch (IOException e) { diff --git a/src/main/java/com/atlauncher/gui/SplashScreen.java b/src/main/java/com/atlauncher/gui/SplashScreen.java index 4ba72926..076b69d6 100644 --- a/src/main/java/com/atlauncher/gui/SplashScreen.java +++ b/src/main/java/com/atlauncher/gui/SplashScreen.java @@ -30,6 +30,7 @@ import javax.swing.JWindow; import org.mini2Dx.gettext.GetText; import com.atlauncher.App; +import com.atlauncher.network.Analytics; import com.atlauncher.utils.Utils; /** @@ -89,6 +90,7 @@ public class SplashScreen extends JWindow { } catch (Exception ignored) { } + Analytics.endSession(); System.exit(0); }); add(forceQuit); diff --git a/src/main/java/com/atlauncher/gui/TrayMenu.java b/src/main/java/com/atlauncher/gui/TrayMenu.java index 6a94cd70..db5f8b3b 100644 --- a/src/main/java/com/atlauncher/gui/TrayMenu.java +++ b/src/main/java/com/atlauncher/gui/TrayMenu.java @@ -110,6 +110,7 @@ public final class TrayMenu extends JPopupMenu implements ConsoleCloseListener, } catch (Exception ignored) { } + Analytics.endSession(); System.exit(0); }); } diff --git a/src/main/java/com/atlauncher/utils/OS.java b/src/main/java/com/atlauncher/utils/OS.java index d31bad15..0aa5f7f7 100644 --- a/src/main/java/com/atlauncher/utils/OS.java +++ b/src/main/java/com/atlauncher/utils/OS.java @@ -519,6 +519,7 @@ public enum OS { } catch (IOException e) { e.printStackTrace(); } + Analytics.endSession(); System.exit(0); }