fix: explicitely end session when using System.exit

This commit is contained in:
Ryan Dowling 2023-07-06 19:38:16 +10:00
parent cf86c50d60
commit 6009e81197
No known key found for this signature in database
GPG key ID: 5539FCDB88950EFD
6 changed files with 9 additions and 0 deletions

View file

@ -247,6 +247,7 @@ public class Launcher {
LogManager.logStackTrace(e); LogManager.logStackTrace(e);
} }
Analytics.endSession();
System.exit(0); System.exit(0);
} }
@ -418,6 +419,7 @@ public class Launcher {
.build()) .build())
.setType(DialogManager.ERROR).show(); .setType(DialogManager.ERROR).show();
OS.openWebBrowser("https://atlauncher.com/downloads"); OS.openWebBrowser("https://atlauncher.com/downloads");
Analytics.endSession();
System.exit(0); System.exit(0);
} }
} }

View file

@ -1115,6 +1115,7 @@ public class Instance extends MinecraftVersion {
if ((App.autoLaunch != null && App.closeLauncher) if ((App.autoLaunch != null && App.closeLauncher)
|| (!App.settings.keepLauncherOpen && !App.settings.enableLogs)) { || (!App.settings.keepLauncherOpen && !App.settings.enableLogs)) {
Analytics.endSession();
System.exit(0); System.exit(0);
} }
@ -1297,6 +1298,7 @@ public class Instance extends MinecraftVersion {
FileUtils.delete(getCustomMinecraftJarLibraryPath()); FileUtils.delete(getCustomMinecraftJarLibraryPath());
} }
if (!App.settings.keepLauncherOpen) { if (!App.settings.keepLauncherOpen) {
Analytics.endSession();
System.exit(0); System.exit(0);
} }
} catch (Exception e1) { } catch (Exception e1) {

View file

@ -243,6 +243,7 @@ public class Server {
.build()) .build())
.setType(DialogManager.INFO).show(); .setType(DialogManager.INFO).show();
} else { } else {
Analytics.endSession();
System.exit(0); System.exit(0);
} }
} catch (IOException e) { } catch (IOException e) {

View file

@ -30,6 +30,7 @@ import javax.swing.JWindow;
import org.mini2Dx.gettext.GetText; import org.mini2Dx.gettext.GetText;
import com.atlauncher.App; import com.atlauncher.App;
import com.atlauncher.network.Analytics;
import com.atlauncher.utils.Utils; import com.atlauncher.utils.Utils;
/** /**
@ -89,6 +90,7 @@ public class SplashScreen extends JWindow {
} catch (Exception ignored) { } catch (Exception ignored) {
} }
Analytics.endSession();
System.exit(0); System.exit(0);
}); });
add(forceQuit); add(forceQuit);

View file

@ -110,6 +110,7 @@ public final class TrayMenu extends JPopupMenu implements ConsoleCloseListener,
} catch (Exception ignored) { } catch (Exception ignored) {
} }
Analytics.endSession();
System.exit(0); System.exit(0);
}); });
} }

View file

@ -519,6 +519,7 @@ public enum OS {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
Analytics.endSession();
System.exit(0); System.exit(0);
} }