Commit graph

852 commits

Author SHA1 Message Date
DreamMaoMao
0673a9241d
Merge pull request #724 from hboetes/fix-last-cursor-use-after-free
Fix use-after-free crash in cursor surface handling
2026-03-02 09:04:43 +08:00
DreamMaoMao
20dbffdfaf opt: avoid unnecessary action when layer surface commit 2026-03-02 08:35:32 +08:00
DreamMaoMao
263b1845bb opt: optimize layer focus change logic 2026-03-02 08:15:52 +08:00
Han Boetes
c403a47894 Fix use-after-free crash in cursor surface handling
### Problem

`setcursor()` stores the client-provided `wlr_surface` pointer in
`last_cursor.surface`, but never registers a destroy listener on it.
When the client exits (e.g. closing a launcher like fuzzel), the surface
is destroyed, but `last_cursor.surface` still holds the stale pointer.

If the cursor hide timeout fires while the cursor surface is alive, and
the client then exits, the next mouse movement calls
`handlecursoractivity()`, which passes the dangling pointer to
`wlr_cursor_set_surface()`. This causes a SIGSEGV in `wl_list_insert()`
inside libwayland-server, as the `wl_list` embedded in the destroyed
surface struct has been freed.

A secondary issue exists in `setcursorshape()`: when a client switches
from a custom cursor surface to a shape cursor, `last_cursor.surface` is
set to NULL but the destroy listener (if registered) is not removed,
leaving a dangling listener on the destroyed surface.

The crash only manifests when `cursor_hidden` is true at the moment of
the mouse movement, which is why it is intermittent and difficult to
reproduce.

### Root cause

Confirmed via `coredumpctl debug` and `bt full`:

```
#0  wl_list_insert (libwayland-server.so)
#1  wlr_cursor_set_surface (libwlroots)
#2  handlecursoractivity (mango.c)
#3  motionnotify (mango.c)
#4  motionrelative (mango.c)
#5  wl_signal_emit_mutable
#6  handle_libinput_readable
```

### Fix

- Add a `wl_listener` (`last_cursor_surface_destroy_listener`) that
clears `last_cursor.surface` and removes itself when the surface is
destroyed.
- Initialize the listener's link in `setup()` so `wl_list_empty()`
checks are reliable from the start.
- In `setcursor()`, remove any existing listener before registering a
new one on the incoming surface.
- In `setcursorshape()`, remove the destroy listener when switching to a
shape cursor.
- Add a NULL guard in `handlecursoractivity()` as a safety net.
2026-03-01 21:58:03 +01:00
DreamMaoMao
6cc7d16281 opt: only set on_demand layer focus when it request in init_commit 2026-03-02 00:56:47 +08:00
DreamMaoMao
94380a3e07
Merge pull request #559 from WeraPea/pointer-events-fix
fix: pointer events being one event behind
2026-02-28 23:36:57 +08:00
DreamMaoMao
835269f86b opt: make spawn and spawn_shell log to debug log 2026-02-26 23:22:51 +08:00
DreamMaoMao
4787402b12 opt: optimize monitorrule check 2026-02-26 13:30:42 +08:00
DreamMaoMao
cbc344ab88 fix: avoid opacity exceeds the threshold due to overshot animation curve 2026-02-26 08:29:27 +08:00
DreamMaoMao
6667708d9a feat: monitor arg support multi spec match in disptach 2026-02-25 19:16:06 +08:00
DreamMaoMao
43d0f0f54a opt: remove useless code 2026-02-25 17:35:19 +08:00
DreamMaoMao
bc5cf2c7d7 opt: remove useless code 2026-02-25 17:25:05 +08:00
qaqland
e1c038ae08 opt: remove unused variable in function rendermon
Signed-off-by: qaqland <anguoli@uniontech.com>
2026-02-25 16:58:18 +08:00
DreamMaoMao
564df864bf fix: popup position constrain not work for some app 2026-02-25 15:23:54 +08:00
DreamMaoMao
a28647585f feat: set dbus env auto 2026-02-24 21:40:26 +08:00
DreamMaoMao
f8fa7a856c opt: optimize frame skip logic 2026-02-23 08:01:45 +08:00
DreamMaoMao
d1fd128981 fix: auto set monitor coordinate when no match monitor rule 2026-02-21 18:55:33 +08:00
DreamMaoMao
3d680523d6 opt: if app open when no monitor, init tags and size in updatemons 2026-02-21 17:01:16 +08:00
DreamMaoMao
07aed60245 opt: improve some risk judgments 2026-02-21 16:37:37 +08:00
DreamMaoMao
2f12f46919 opt: use base surface of client when xytonode in rect node 2026-02-19 19:07:44 +08:00
DreamMaoMao
68075c0044 feat: support index arg in switch_keyboard_layout 2026-02-19 11:23:08 +08:00
DreamMaoMao
23d7b11e27 fix: only apply scroller overspread to head and tail client 2026-02-19 11:17:36 +08:00
DreamMaoMao
6924ca8512 feat: add global option prefer_scroller_overspread 2026-02-19 00:00:58 +08:00
DreamMaoMao
c3dcee2c8e opt: remove useless code 2026-02-17 08:33:45 +08:00
DreamMaoMao
112fb5c007 opt: optimize code struct 2026-02-16 10:06:16 +08:00
DreamMaoMao
1158fb2e3c opt: don't skip frame when grab client 2026-02-16 07:46:42 +08:00
DreamMaoMao
7ccbeae8b8 fix: if the progress not the child of main, not assume it is stop 2026-02-15 14:08:53 +08:00
DreamMaoMao
49cb5a9d7e feat: support frame skip for x11 app resize 2026-02-15 12:50:42 +08:00
DreamMaoMao
0696fe964d opt: optimize frame skip logic 2026-02-15 10:31:23 +08:00
DreamMaoMao
842b45b584 feat: add skip timer to avoid rermanently block render 2026-02-15 09:02:36 +08:00
DreamMaoMao
02067e3b1e fix: some client property missing init 2026-02-15 08:07:00 +08:00
DreamMaoMao
fdd54afb7e fix: some app frame skip fail when disable animaitons 2026-02-15 08:00:44 +08:00
DreamMaoMao
91110efe0e
Merge pull request #645 from jampe/feature-config-isfakefullscreen
support isfakefullscreen as windowrule property
2026-02-14 08:46:23 +08:00
DreamMaoMao
89413aacf5 fix: fix center tile size per reset 2026-02-14 08:35:30 +08:00
DreamMaoMao
0fe87e6286 fix: fix multi master focus record error 2026-02-13 20:23:03 +08:00
DreamMaoMao
c05eec7f53 feat: support restore stack from non-tile state 2026-02-13 20:02:23 +08:00
DreamMaoMao
8a924494c6 opt: the tagset is current tagset when open window in ov mode 2026-02-13 18:16:06 +08:00
DreamMaoMao
711498490b opt: not back to ov tag when view prev tag 2026-02-13 18:11:18 +08:00
DreamMaoMao
f251615524 opt: flush the blur background cache when unmap a background layer 2026-02-13 11:07:11 +08:00
DreamMaoMao
313adefd10 opt: better x11 coordinate adjust 2026-02-12 18:55:03 +08:00
DreamMaoMao
17acdae69c opt: make x11 floating window coordinate auto ajust the monitor change 2026-02-12 18:12:01 +08:00
DreamMaoMao
bc52b95c1e opt: make x11 unmanaged window coordinate auto ajust the monitor change 2026-02-12 18:10:02 +08:00
DreamMaoMao
53ee82a726 feat: make force_tiled_state as a option 2026-02-12 11:19:39 +08:00
DreamMaoMao
8484093e32 fix: crash when pointerfocus to a null scene client 2026-02-11 20:44:44 +08:00
DreamMaoMao
b5a157038c opt: tell the synckeymap timer not need to call anymore 2026-02-11 08:31:22 +08:00
DreamMaoMao
783cb86c56 feat: support match monitor make model serial 2026-02-10 10:31:31 +08:00
DreamMaoMao
b05bc1ce65 opt: add btn_left and btn_right bind check in config check 2026-02-09 11:50:54 +08:00
DreamMaoMao
6b79a432a4 opt: allow none mode in some mouse button 2026-02-09 11:18:14 +08:00
Daniel Jampen
454145f6e0
support isfakefullscreen as windowrule property 2026-02-08 17:56:26 +01:00
DreamMaoMao
e8bf6380fb opt: turn keymap sync into XWAYLAND macro 2026-02-08 12:44:56 +08:00