Skip to content

fix: release active popup grabs on toplevel destruction. If a window … - #2584

Merged
Drakulix merged 1 commit into
pop-os:masterfrom
littlezabi:fix/stuck-popup-grabs
Jul 21, 2026
Merged

Drakulix merged 1 commit into
pop-os:masterfrom
littlezabi:fix/stuck-popup-grabs

Conversation

@littlezabi

@littlezabi littlezabi commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

The Problem

When a client window is destroyed, any active Wayland popup grabs associated with the seat are not automatically cleared. The compositor remains in a grab state, redirecting all keyboard and mouse inputs to a non-existent surface. The user's desktop becomes unresponsive (mouse cursor still moves, but clicks are ignored and keyboard shortcuts stop working).

How to Reproduce

  1. Open a terminal and launch several background processes (e.g., local development servers/workers).
  2. Abruptly close the terminal or kill the terminal processes all at once.
  3. This triggers a client process crash, causing the system's crash reporter dialog (apport-gtk or similar) to spawn a modal popup.
  4. Because the grab state was orphaned during the abrupt client close, the input focus gets permanently locked, rendering the desktop session frozen.

I submitted a bug report three weeks ago via the Pop! OS github repository.
check pop-os/pop#4030

Video Demonstration on testing device

41582.1.mp4

System Specifications Summary

Device Model: Lenovo ThinkPad (Modal 20S00043UK)
Processor: Intel(R) Core(TM) i5-10210U
RAM: 16 GB System Memory
GPU: Intel CometLake-U GT2 [UHD Graphics]
Display Interface: /dev/fb0
Storage: 512GB SanDisk SSD

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Thank you guys! :) I really like Pop os and appreciate your works

@Drakulix Drakulix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down, couple of remarks:

Comment thread src/wayland/handlers/xdg_shell/mod.rs Outdated
@littlezabi
littlezabi force-pushed the fix/stuck-popup-grabs branch 3 times, most recently from 4e6bceb to 8eaf505 Compare July 17, 2026 20:08
@littlezabi
littlezabi requested a review from Drakulix July 20, 2026 05:34

@Drakulix Drakulix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little nitpick. Looks good otherwise! Thanks :)

Comment thread src/wayland/handlers/xdg_shell/mod.rs Outdated
@littlezabi
littlezabi force-pushed the fix/stuck-popup-grabs branch from a77b8d4 to 771f6f9 Compare July 20, 2026 16:34
@littlezabi
littlezabi requested a review from Drakulix July 20, 2026 16:40
@littlezabi
littlezabi force-pushed the fix/stuck-popup-grabs branch from 37ab33f to 91041df Compare July 21, 2026 10:51
Drakulix
Drakulix previously approved these changes Jul 21, 2026
@Drakulix
Drakulix requested a review from a team July 21, 2026 11:07
jklgrasso
jklgrasso previously approved these changes Jul 21, 2026
@Drakulix

Copy link
Copy Markdown
Member

@littlezabi Can you please run cargo fmt on your PR?

    If a window with an active popup grab is closed or crashes unexpectedly, the input grab state can get stuck, freezing keyboard and mouse clicks.
    This patch iterates over all seats and releases the active seat grab if it is owned by the destroyed window or one of its child popups.

Signed-off-by: littlezabi <zohaibjozvi@gmail.com>
@littlezabi
littlezabi dismissed stale reviews from jklgrasso and Drakulix via a7d7bce July 21, 2026 14:37
@littlezabi
littlezabi force-pushed the fix/stuck-popup-grabs branch from 93c88bb to a7d7bce Compare July 21, 2026 14:37
@littlezabi

Copy link
Copy Markdown
Contributor Author

@littlezabi Can you please run cargo fmt on your PR?
All formatted now.

@Drakulix
Drakulix requested a review from jklgrasso July 21, 2026 15:50
@Drakulix
Drakulix merged commit 1d72227 into pop-os:master Jul 21, 2026
8 of 10 checks passed
@littlezabi
littlezabi deleted the fix/stuck-popup-grabs branch July 24, 2026 19:19
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.

3 participants