Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release all grabs when unmanaging windows #3857

Merged
merged 1 commit into from
Dec 31, 2023

Conversation

gldrk
Copy link
Contributor

@gldrk gldrk commented Sep 26, 2023

When a top-level window is unmapped, awesome stops tracking it, possibly leaving behind stale passive grabs. If the window is later reparented and mapped again, these grabs can become activated, locking the pointer. awesome does not release grabs on windows it’s not managing, even though it technically could. The only remedy is destroying the poisoned window.

This was discovered while using tabbed.

When a window is unmapped, awesome stops tracking it, possibly
leaving stale grabs behind.  These grabs can be activated if the
window is mapped again without awesome’s knowledge.  This results
in a locked pointer until the grab window is destroyed.

Fix by releasing passive grabs before untracking a client window.
@@ -3010,6 +3010,8 @@ client_unmanage(client_t *c, client_unmanage_t reason)

if(reason != CLIENT_UNMANAGE_DESTROYED)
{
xwindow_buttons_grab(c->window, &(button_array_t){ .len = 0 });
xwindow_grabkeys(c->window, &(key_array_t){ .len = 0 });
Copy link
Member

Choose a reason for hiding this comment

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

Random drive by comment:
Both these functions do "ungrab everything, then re-grab all the requested stuff". Due to the empty argument, the re-grabbing doesn't do anything. Dunno if it would be simpler to just copy the "ungrab everything" request here.

But whatever. You still get my 👍 .

@Elv13 Elv13 closed this Dec 31, 2023
@Elv13 Elv13 reopened this Dec 31, 2023
Copy link

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (aa8c7c6) 91.02% compared to head (16c560a) 91.01%.
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3857      +/-   ##
==========================================
- Coverage   91.02%   91.01%   -0.01%     
==========================================
  Files         901      901              
  Lines       57537    57568      +31     
==========================================
+ Hits        52372    52395      +23     
- Misses       5165     5173       +8     
Flag Coverage Δ
gcov 91.01% <100.00%> (-0.01%) ⬇️
luacov 93.72% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
objects/client.c 83.94% <100.00%> (+0.02%) ⬆️

... and 7 files with indirect coverage changes

@mergify mergify bot merged commit 2682bcb into awesomeWM:master Dec 31, 2023
9 checks passed
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