Bug 498456 - "Setup Window Shortcut" can be triggered twice, causing crash
Summary: "Setup Window Shortcut" can be triggered twice, causing crash
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.2.5
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-10 08:46 UTC by hiim11354428
Modified: 2025-01-11 09:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 6.3
Sentry Crash Report:


Attachments
Backtrace. Missing a few debug symbols. Lines #7 and #8 in Thread 1 seem like the important part. (52.60 KB, text/plain)
2025-01-10 08:46 UTC, hiim11354428
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hiim11354428 2025-01-10 08:46:52 UTC
Created attachment 177251 [details]
Backtrace. Missing a few debug symbols. Lines #7 and #8 in Thread 1 seem like the important part.

SUMMARY
If you have a shortcut configured to activate "Setup Window Shortcut", you can activate it while the dialog box to setup a window shortcut is open, which causes KWin to crash.
I've encountered this problem on occasion; I think it's because I have a wireless keyboard and it occasionally sends a keypress twice.

STEPS TO REPRODUCE
1. Add a custom window shortcut for "Setup Window Shortcut" (e.g. setting it to Meta+Return)
2. Focus on a window
3. Hit the shortcut twice in a row

Alternatively, you can use a shortcut to activate the Window Operations Menu and select "Setup Window Shortcut" from there.

OBSERVED RESULT
Upon pressing the shortcut a second time, KWin freezes for a bit, then crashes and restarts.

EXPECTED RESULT
Second press of the shortcut should be ignored.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 6.2
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.8.0-51-generic (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
From looking around in the source code (kwin/src/useractions.cpp, line 1081), I believe this comes from a failed assert?
This seems to be confirmed in the backtrace (lines marked #7 and #8 in Thread 1). I didn't get enough debug symbols to fill out the full backtrace, but the ones I'm missing don't seem to be relevant (though I can install more if needed).
Comment 1 Bug Janitor Service 2025-01-10 10:49:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6984
Comment 2 David Redondo 2025-01-11 09:00:08 UTC
Git commit b36151e81a456d25b118abadb791b4a12bc624be by David Redondo.
Committed on 11/01/2025 at 08:45.
Pushed by davidre into branch 'master'.

Dont assert in  Workspace::setupWindowShortcut

This can be triggered by shortcuts which can be emitted
multiple times.
FIXED-IN:6.3

M  +3    -1    src/useractions.cpp

https://invent.kde.org/plasma/kwin/-/commit/b36151e81a456d25b118abadb791b4a12bc624be
Comment 3 David Redondo 2025-01-11 09:19:51 UTC
Git commit c72507977f42d12b24c697ed902dbae2def5909c by David Redondo.
Committed on 11/01/2025 at 09:01.
Pushed by davidre into branch 'Plasma/6.3'.

Dont assert in  Workspace::setupWindowShortcut

This can be triggered by shortcuts which can be emitted
multiple times.
FIXED-IN:6.3


(cherry picked from commit b36151e81a456d25b118abadb791b4a12bc624be)

Co-authored-by: David Redondo <kde@david-redondo.de>

M  +3    -1    src/useractions.cpp

https://invent.kde.org/plasma/kwin/-/commit/c72507977f42d12b24c697ed902dbae2def5909c