astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.04k stars 75 forks source link

Don't create new requestor objects for finished transfers #97

Open hackerb9 opened 3 years ago

hackerb9 commented 3 years ago

Currently, when xclip owns the selection and it finishes sending the data via INCR, xcin() returns 1 to signal that it is done and the requestor should be deleted from our linked list in xclip.c. However, after doing that, xclip immediately recreates the requestor it just deleted after receiving a final PropertyNotify message from the client to let us know that it is finished. We ignore the message, so no harm is done, but it is a silly thing to do.

hackerb9 commented 3 years ago

It may make sense to use the PropertyNotify events to move the state machine in xcin() forward instead of ignoring them. Currently, only PropertyNotify events with evt.state == PropertyDelete are used and only in XCIN_INCR. It is typical to receive evt.state == PropertyNewValue during INCR, but we just ignore them.