Properly shutdown everything on window close
- Properly shutdown applet on window close - Properly remove system tray icon on close - Shutdown executorService on shutdown Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
@@ -111,6 +112,9 @@ public class RuneLite
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private ScheduledExecutorService executorService;
|
||||
|
||||
@Inject
|
||||
private Provider<ItemManager> itemManager;
|
||||
|
||||
@@ -294,6 +298,7 @@ public class RuneLite
|
||||
{
|
||||
clientSessionManager.shutdown();
|
||||
discordService.close();
|
||||
executorService.shutdown();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.awt.Graphics;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -267,6 +268,21 @@ public class ClientUI
|
||||
{
|
||||
saveClientBoundsConfig();
|
||||
runelite.shutdown();
|
||||
|
||||
if (SystemTray.isSupported())
|
||||
{
|
||||
SystemTray.getSystemTray().remove(trayIcon);
|
||||
}
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
client.stop();
|
||||
}
|
||||
|
||||
if (client instanceof Client)
|
||||
{
|
||||
((Client)client).shutDown();
|
||||
}
|
||||
},
|
||||
this::showWarningOnExit
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user