-
Notifications
You must be signed in to change notification settings - Fork 73
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
Misbehaving applications can lock up xclip #34
Comments
Thanks for the report. It is probably possible to deal with this situation better. However, to be honest, I lack the knowledge how it should be, and the time to research. It might be useful to check what other applications and toolkits does, though. |
Just spent a day debugging this issue (trying to run |
Closing stdout and stderr when running |
If pull request #88 is merged, I believe this bug can be closed. |
When an xclip-owned selection has enough data to trigger the use of the INCR protocol when transferring, and an application that doesn't implement the INCR protocol requests clipboard data, xclip will enter the XCLIB_XCIN_INCR state, and then wait forever for the application to delete the INCR property, which will never happen.
While in that state, SelectionRequest events from other applications are not processed, and so the clipboard data becomes inaccessible: any application that tries to access the selection will freeze, waiting forever for a SelectionNotify event from xclip.
In my case, this bug was triggered by fcitx automatically grabbing the contents of the clipboard and locking up xclip whenever I tried to xclip -i something larger than 1MB, like a big enough screenshot. Killing fcitx let the clipboard work as expected, but I don't think a misbehaving application should be allowed to lock up xclip in the first place.
I'm not sure what the best solution would be for this ; I have an ugly fix here which "solves" the problem by just not caring about state at all and always responding to SelectionNotify events. That works well enough for me, but it is still pretty fragile (what happens if two applications request data at the same time?)...
Ideally, xclip should keep track of every INCR transfer separately so that it can still serve clipboard data while it's waiting for another INCR transfer to complete, but i'm not familiar enough with the code to actually implement that.
The text was updated successfully, but these errors were encountered: