From 3fe38a4261ee5f5ed9ae99f4409cbccde344d06e Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 23 Sep 2024 13:57:41 +0000 Subject: [PATCH] Context shutdown fixes --- .../main/java/io/xpipe/app/comp/store/StoreCreationComp.java | 5 ++++- core/src/main/java/io/xpipe/core/process/ProcessControl.java | 2 ++ .../java/io/xpipe/core/store/ShellValidationContext.java | 2 +- lang/base/strings/translations_en.properties | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java index 4c5e2e25e..19df3a99a 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComp.java @@ -167,6 +167,9 @@ public class StoreCreationComp extends DialogComp { v -> true, (newE, context, validated) -> { ThreadHelper.runAsync(() -> { + if (context != null) { + context.close(); + } if (!DataStorage.get().getStoreEntries().contains(e)) { DataStorage.get().addStoreEntryIfNotPresent(newE); } else { @@ -196,7 +199,7 @@ public class StoreCreationComp extends DialogComp { (e, context, validated) -> { try { DataStorage.get().addStoreEntryIfNotPresent(e); - if (validated + if (context != null && validated && e.getProvider().shouldShowScan() && AppPrefs.get() .openConnectionSearchWindowOnConnectionCreation() diff --git a/core/src/main/java/io/xpipe/core/process/ProcessControl.java b/core/src/main/java/io/xpipe/core/process/ProcessControl.java index c8a054d8c..ef489093d 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessControl.java +++ b/core/src/main/java/io/xpipe/core/process/ProcessControl.java @@ -34,6 +34,8 @@ public interface ProcessControl extends AutoCloseable { @Override void close() throws Exception; + void shutdown() throws Exception; + void kill(); ProcessControl start() throws Exception; diff --git a/core/src/main/java/io/xpipe/core/store/ShellValidationContext.java b/core/src/main/java/io/xpipe/core/store/ShellValidationContext.java index a4710f5b4..0357c497e 100644 --- a/core/src/main/java/io/xpipe/core/store/ShellValidationContext.java +++ b/core/src/main/java/io/xpipe/core/store/ShellValidationContext.java @@ -17,7 +17,7 @@ public class ShellValidationContext implements ValidationContext { @Override public void close() { try { - shellControl.close(); + shellControl.shutdown(); } catch (Exception ignored) { } } diff --git a/lang/base/strings/translations_en.properties b/lang/base/strings/translations_en.properties index 7c1af8e59..b0d63da77 100644 --- a/lang/base/strings/translations_en.properties +++ b/lang/base/strings/translations_en.properties @@ -167,7 +167,6 @@ init=Init shell=Shell hub=Hub #context: Computer script -#force script=script