From 4f1e6ea5f1f3fca8e7a38eab0a10c388e5e0eff1 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 23 Jul 2024 11:45:33 +0000 Subject: [PATCH] Fix orphaned connections on load --- .../java/io/xpipe/app/storage/StandardStorage.java | 14 ++++++++++++-- .../java/io/xpipe/app/util/AppJacksonModule.java | 6 +++++- dist/changelogs/10.2_incremental.md | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java index 0a2d46f4..608d819d 100644 --- a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java @@ -215,17 +215,26 @@ public class StandardStorage extends DataStorage { local.setColor(DataStoreColor.BLUE); } - callProviders(); + // Reload stores, this time with all entry refs present + // These do however not have a completed validity yet refreshEntries(); + // Bring entries into completed validity if possible + // Needed for chained stores + refreshEntries(); + // Let providers work on complete stores + callProviders(); + // Update validaties after any possible changes + refreshEntries(); + // Add any possible missing synthetic parents storeEntriesSet.forEach(entry -> { var syntheticParent = getSyntheticParent(entry); syntheticParent.ifPresent(entry1 -> { addStoreEntryIfNotPresent(entry1); }); }); + // Update validaties from synthetic parent I changes refreshEntries(); - // Save to apply changes if (!hasFixedLocal) { storeEntriesSet.removeIf(dataStoreEntry -> !dataStoreEntry.getUuid().equals(LOCAL_ID) && dataStoreEntry.getStore() instanceof LocalStore); @@ -235,6 +244,7 @@ public class StandardStorage extends DataStorage { entry.dirty = true; entry.setStoreNode(JacksonMapper.getDefault().valueToTree(entry.getStore())); }); + // Save to apply changes save(false); } diff --git a/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java b/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java index a47fd4d3..f8493ff4 100644 --- a/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java +++ b/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java @@ -171,7 +171,11 @@ public class AppJacksonModule extends SimpleModule { // Compatibility fix for legacy local stores var toUse = e.getStore() instanceof LocalStore ? DataStorage.get().local() : e; - return toUse != null ? new DataStoreEntryRef<>(toUse) : null; + if (toUse == null) { + return null; + } + + return new DataStoreEntryRef<>(toUse); } } } diff --git a/dist/changelogs/10.2_incremental.md b/dist/changelogs/10.2_incremental.md index 8d62fb50..36c41167 100644 --- a/dist/changelogs/10.2_incremental.md +++ b/dist/changelogs/10.2_incremental.md @@ -18,6 +18,7 @@ - Add support for VNC RSA-AES authentication schemes, allowing to connect to more types of VNC servers - Services can now be opened in a browser using either HTTP or HTTPs - You can now create shortcuts to automatically forward and open services in a browser +- Fix doctor containers in some cases not persisting, leaving invalid orphan connections behind on the bottom - Improve description for service groups - Publish API libraries to maven central - Show warning when launching PowerShell in constrained language mode