fix: guard raise/focus/activate against unmanaged windows#520
Open
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
Open
fix: guard raise/focus/activate against unmanaged windows#520mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
Conversation
Forge calls metaWindow.raise()/.focus()/.activate() on windows held
by its tree after Mutter has unmanaged them, which fires assertion
warnings on every churn (alt-tab, app close, swap):
meta_window_set_stack_position_no_sync:
assertion 'window->stack_position >= 0' failed
The compositor private of an unmanaged window is null, so a single
get_compositor_private() check is enough to short-circuit before the
call hits Mutter. Add lib/extension/mutter-safe.js with isWindowAlive()
+ safeRaise/safeFocus/safeActivate wrappers, and route the call sites
in tree.js and window.js through them.
Behaviour for live windows is unchanged. For dead windows, the
operation is silently skipped instead of warning. Complementary to
8716a05 ("guard tree rendering against destroyed window actors"),
which already guards the *render* path (move + border draw); the
focus path remained unguarded.
Verified by churn test: 20 cycles of nautilus open/close (~5s),
journal stays silent on stack_position warnings (was 1-2/min during
normal use before the patch).
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failedfloods the journal on window churn (alt-tab, app close, tile swap) on GNOME 49. Mutter setsstack_position = -1and clearscompositor_privatethe moment a window is unmanaged, so any subsequent call into the stack-manipulation API (raise,focus,activate) fails its assertion and gnome-shell pays the cost on every event.8716a05 already guards the render path (
move, border draw). The focus path was still unguarded —metaWindow.raise()/.focus()/.activate()calls throughouttree.jsandwindow.js.What this PR does
lib/extension/mutter-safe.jswithisWindowAlive(metaWindow)(a singleget_compositor_private()check) plussafeRaise/safeFocus/safeActivatewrappers.tree.js(3) andwindow.js(5) through these helpers.Behaviour for live windows is unchanged. Dead-window operations now short-circuit silently instead of firing the assertion.
Test plan
node --check) on all touched files.nautilus &; sleep 0.3; kill <pid>over ~6s.Notes
stack_position.get_compositor_private() !== null; this matches the same idiom Forge already uses in places liketree.js:89(this._actor = this._data.get_compositor_private()), so no new dependency on Mutter internals.