From aae95a9489b80241f20cc2ce3e1f750a25ae00a8 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 30 Mar 2026 09:52:04 +0300 Subject: [PATCH] Best effort attempt at cleaning up the WindowManger registered coordinators. --- ElementX/Sources/Application/Windowing/WindowManager.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Application/Windowing/WindowManager.swift b/ElementX/Sources/Application/Windowing/WindowManager.swift index 8591a370e..9806268e4 100644 --- a/ElementX/Sources/Application/Windowing/WindowManager.swift +++ b/ElementX/Sources/Application/Windowing/WindowManager.swift @@ -89,7 +89,11 @@ class WindowManager: SecureWindowManagerProtocol { return AnyView(InstantlyDismissingWindow()) } - return coordinator.toPresentable() + // This behaves strangely and gets called late but cleans up enough + // and is self contained enough to be just good .. enough + return AnyView(coordinator.toPresentable().onDisappear { [weak self] in + self?.coordinators[type] = nil + }) } func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType) {