Skip to content

Conversation

D4yvid
Copy link

@D4yvid D4yvid commented Oct 1, 2025

If wasFocused is true, the value of new_focused_window shouldn't be NULL, but in a specific scenario, it is, and the window manager just SEGV. I triggered this SIGSEGV myself while using NEXTSPACE. Debian 12 under Bedrock Linux (no influence of other distros, only Debian packages & build tools).

The flow of:

1534 | if (!wwin->prev && !wwin->next) {
1535 |   /* was the only window */
1536 |   scr->focused_window = NULL;
1537 |   new_focused_window = NULL;

doesn't set wasFocused to false, but new_focused_window is NULL, and this code flow segfaults the entire WM.

Crash:

Thread 4 "Workspace" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeefd56c0 (LWP 70817)]
0x000055555561d3f3 in wUnmanageWindow (wwin=0x7fffe0036fb0, restore=0,
    destroyed=1) at WM/window.c:1560
1560	    WApplication *napp = wApplicationOf(new_focused_window->main_window);

…dow was being unmanaged by the WM and there's not any other window to focus

If `wasFocused` is `true`, the value of `new_focused_window` shouldn't
be NULL, but in a specific scenario, it is, and the window manager just
SEGV. I triggered this SIGSEGV myself while using NEXTSPACE. Debian 12
under Bedrock Linux (no influence of other distros, only Debian packages
& build tools).

The flow of:
```
1534 | if (!wwin->prev && !wwin->next) {
1535 |   /* was the only window */
1536 |   scr->focused_window = NULL;
1537 |   new_focused_window = NULL;
```

doesn't set `wasFocused` to `false`, but `new_focused_window` is NULL,
and this code flow segfaults the entire WM.

Crash:
```
Thread 4 "Workspace" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeefd56c0 (LWP 70817)]
0x000055555561d3f3 in wUnmanageWindow (wwin=0x7fffe0036fb0, restore=0,
    destroyed=1) at WM/window.c:1560
1560	    WApplication *napp = wApplicationOf(new_focused_window->main_window);
(gdb) bt
    destroyed=1) at WM/window.c:1560
    at WM/event.c:647
    at WM/event.c:231
    at WM/event.c:949
    at WM/event.c:239
    at WM/core/wevent.c:227
```
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.

1 participant