Skip to content

fix: add guard checks when destroying window - #117

Merged
flexagoon merged 2 commits into
flexagoon:mainfrom
matheus-inacio:fix/error-on-destroy-window
Nov 11, 2025
Merged

fix: add guard checks when destroying window#117
flexagoon merged 2 commits into
flexagoon:mainfrom
matheus-inacio:fix/error-on-destroy-window

Conversation

@matheus-inacio

@matheus-inacio matheus-inacio commented Nov 8, 2025

Copy link
Copy Markdown

Description

This PR fixes a race condition that occurs when a window is being destroyed (closed).

Signals like notify::size, size-changed, notify::appears-focused or workspace-changed can sometimes fire after the underlying Meta.Window object has been cleared, but before the actor is fully disconnected. This results in the extension trying to access properties on a null window object, causing the following error:

JS ERROR: TypeError: can't access property "get_client_type", win is null
getRoundedCornersEffect@file:///home/matheus/.local/share/gnome-shell/extensions/rounded-window-corners@fxgn/manager/utils.js:50:5
refreshRoundedCorners@file:///home/matheus/.local/share/gnome-shell/extensions/rounded-window-corners@fxgn/manager/event_handlers.js:164:43
applyEffectTo/<@file:///home/matheus/.local/share/gnome-shell/extensions/rounded-window-corners@fxgn/manager/event_manager.js:119:18
_destroyWindowDone@resource:///org/gnome/shell/ui/windowManager.js:1590:21
onStopped@resource:///org/gnome/shell/ui/windowManager.js:1558:39
_makeEaseCallback/<@resource:///org/gnome/shell/ui/environment.js:66:22
_easeActor/<@resource:///org/gnome/shell/ui/environment.js:161:64
@resource:///org/gnome/shell/ui/init.js:21:20

PS: In the error log above, the crash specifically happened during the size-changed signal.

Changes

I've added null checks for actor.metaWindow within the signal callbacks in event_manager.ts. This ensures that the handlers only run if the window still actively exists.

@flexagoon

Copy link
Copy Markdown
Owner

Is it maybe possible to just move this check into the connect method to avoid repeating it everywhere? And then you could also add a comment above it explaining why it's needed

@flexagoon

Copy link
Copy Markdown
Owner

Never mind, moving it into connect would probably be very had to do in TypeScript because the actor variable is defined in different places. LGTM then, thanks!

@flexagoon
flexagoon merged commit 933e3e8 into flexagoon:main Nov 11, 2025
1 of 2 checks passed
flexagoon pushed a commit that referenced this pull request Nov 11, 2025
Signals like `notify::size`, `size-changed`, `notify::appears-focused` or `workspace-changed` can sometimes fire after the underlying `Meta.Window` object has been cleared, but before the actor is fully disconnected. This results in the extension trying to access properties on a null window object, causing an error.

Co-authored-by: Matheus Medeiros <matheus.medeiros@insidesistemas.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants