fix(mac): forget the windows that the application reaper removes

BEHAVIOUR (registry only). Review finding 4, the part that can be done where a
window id is known.

Window::observe now registers the windows that are really observed (previous
revision), and a window that closes while its application runs left its entry
until the application quit. WindowManagerEvent::Destroy carries no window id,
but reap_invalid_windows_for_application is where the daemon works out which of
the application's windows are gone, and it already removes them from the
workspace: it now also forgets them in the registry (tiled and floating
alike); the reaper's reap_window did already.

What stays: an observed window that closes without passing through either
(for example one that was unmanaged and then closed, or whose Destroy was not
followed by a reap) keeps its entry (an element, an observer and an inert
application) until its application quits; the table is bounded by the number
of windows the daemon has observed per running application, and a periodic
sweep would cost one Accessibility call per entry under the window manager lock.
Hand check H4 measures the Mach ports held (the one unverified cost: whether an
AXObserver holds a port).

Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run. Verified on the Mini: not yet.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:26 -08:00
1 parent 1d1ec156c5
commit 5b5647ea34
1 file changed
+2
@@ -432,10 +432,12 @@ impl WorkspaceExt for Workspace {
for window_id in &invalid_window_ids {
// Ignore errors - window may have already been removed by the reaper thread
let _ = self.remove_window(*window_id);
crate::ax_registry::forget(*window_id);
}
for window_id in &invalid_floating_window_ids {
self.remove_floating_window(*window_id);
crate::ax_registry::forget(*window_id);
}
tracing::debug!(