domferr / domferr/tilingshell

SelectionTilePreview crash: "has been already disposed" when another extension reloads a stylesheet during screen unlock

Open Beginner friendly
#602 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

### SelectionTilePreview crash: "has been already disposed" when another extension reloads a stylesheet during screen unlock

**Environment:** GNOME Shell 46 (Zorin OS 18.1, zorin-tiling-shell — same code as upstream `src/components/tilepreview/selectionTilePreview.ts`)

**Error (repeated):**
```
Object .SelectionTilePreview (0x…) has been already disposed — impossible to access it.
#0 selectionTilePreview.js:52 (_recolor)
#1 selectionTilePreview.js:21 (ThemeContext 'changed' handler)
```
The extension then enters ERROR state: snap-assist drop targets render blank (empty drag panel), and the tiling work area stops updating.

**Trigger:** screen unlock. The session-mode pop re-enables all extensions; another extension (highlight-focus) calls `theme.load_stylesheet()` during its `enable()`, which fires `St.ThemeContext "changed"` — and `SelectionTilePreview._recolor()` runs on a preview object that was already disposed during teardown.

**Root cause:** the ThemeContext signal connection is only disconnected on the JS `destroy` signal:
```ts
this.connect('destroy', () => St.ThemeContext…disconnect(styleChangedSignalID));
```
When the actor is disposed from C during extension teardown, `destroy` never fires, the connection leaks, and the next theme change calls `_recolor()` (which does `this.set_style(null)` / `get_theme_node()`) on a dead object.

**Suggested fix:** guard `_recolor()` against the disposed state (check `this._destroyed` or wrap in try/catch), and/or disconnect the signal in `dispose()` rather than relying solely on `destroy`.

> _AI-assisted issue — drafted by Hermes Agent (Nous Research) on behalf of @louquillio._

Contributor guide

Open the contributing guide

Research direction

Start in src/components/tilepreview/selectionTilePreview.ts, focusing on _recolor() and the St.ThemeContext "changed" connection cleanup. Reproduce the screen-unlock/theme-reload sequence described in the issue, then verify that a disposed preview is not accessed and that snap-assist drop targets and the tiling work area continue updating.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.