Fail gracefully instead of crashing if grab fails with the error "Could not grab modal" #1031
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have been using PaperWM on a daily basis for the past few months and it is great. One of the problems that I kept running into repeatedly was #991. This issue was reported on Gnome 47. I ran into this problem on Gnome 42.9.
I attempted a naive fix which simply tries to clean-up all the state instead of crashing. This works well; I have been using a version of this fix, applied on top of the gnome-44 branch, for the past month and I have not suffered any
Could not grab modal
crashes. I have backported this change to thegnome-44
branch as well: #1032.It would be great if I could get some guidance about whether this fix looks logical, and whether there might be a way to reproduce this code path somehow. We need to somehow get into
preview_navigate
(which happens when one uses a keyboard shortcut to switch windows, I believe?) but get there in a state where the keyboard is already grabbed by something else, thus causing PaperWM to fail to grab the keyboard.Meanwhile, I will continue to use PaperWM daily on two machines (albeit with old Gnome versions: 3.38 and 42.9) I will attempt to get PaperWM up and running on a more recent version and check to see if I run into this crash on the default branch; if I do, then, I will also see whether this fix solves the crash.
I would really like to fix this issue within PaperWM (upstream) because I have not run into any other bug at all and this is a great project!