-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Unsafe getWindowAttributes
calls in ~20 modules
#146
Comments
Thanks for starting the conversation about this. I think the plan we are considering is creating a new set of functions in X11 that return a |
Yeah, that seems like a good choice. I'm happy to help with anything that doesn't require massive amounts of X11 knowledge. By the way, |
This needs to start with work on the xmonad/x11 project. You don't need to know about X11, you'll just be updating unsafe functions and making them safe. |
I was looking at making a PR for the xmonad repo that works with the X11 repo from @SirBoonami Fixing all the type errors is somewhat easy, but what should we do with the error messages? Print to stderr, silently ignore, or are there some where we want to crash/recover? |
The changes mentioned in xmonad/X11#51 are still in the "draft" stage. Basing anything on top of them would be a waste of time as I can guarantee that they won't get merged in the state they're in now. But I appreciate your offer to help; I'll come back to you as soon as the X11 part is done. |
Whenever possible, prefer the safe wrappers withWindowAttributes or safeGetWindowAttributes to getWindowAttributes. Places where these are not applicable are limited to layouts, where there is not good "default value" to give back in case these calls fail. In these cases, we let the exception handling of the layout mechanism handle it and fall back to the Full layout. Fixes: xmonad#146
Whenever possible, prefer the safe wrappers withWindowAttributes or safeGetWindowAttributes to getWindowAttributes. Places where these are not applicable are limited to layouts, where there is not good "default value" to give back in case these calls fail. In these cases, we let the exception handling of the layout mechanism handle it and fall back to the Full layout. Fixes: xmonad#146
Whenever possible, prefer the safe wrappers withWindowAttributes or safeGetWindowAttributes to getWindowAttributes. Places where these are not applicable are limited to layouts, where there is not good "default value" to give back in case these calls fail. In these cases, we let the exception handling of the layout mechanism handle it and fall back to the Full layout. Fixes: xmonad#146
I've been running into some xmonad crashes lately, but they've been pretty hard to isolate and reproduce. All of them quit with the same
user error in getWindowAttributes
message, so I've decided to grep forgetWindowAttributes
through bothxmonad
andxmonad-contrib
. Here's what I've come up with:getWindowAttributes
being an unsafe function. It is implemented as a wrapper around anunsafe
foreign
C function. However, its documentation doesn't mention anything. (Maybe I should open an issue there as well?)xmonad
code was mostly fine, only one unsafe call I fixed in Rare crash fix due to uncaught exception fromgetWindowAttributes
xmonad#76.getWindowAttributes
calls spread over 21 modules inxmonad-contrib
, only two catch the exception (details further down below).Considering the amount of changes necessary to safely wrap all those, I wanted to ask for advice on how to proceed before doing anything on my own.
P.S.: Sorry for not using your issue template, but it didn't seem appropriate for the kind of problem.
Sorted + filtered output of
grep -Hn getWindowAttributes **/*.hs
GOOD:
BAD:
The text was updated successfully, but these errors were encountered: