emacs-exwm / xelb

X protocol Emacs Lisp Binding
https://elpa.gnu.org/packages/xelb.html
GNU General Public License v3.0
24 stars 4 forks source link

`xcb:-connection-setup-filter` drops data #8

Open Stebalien opened 7 months ago

Stebalien commented 7 months ago

I'm pretty sure it's supposed to put any unread messages back in the message cache, but it doesn't.

medranocalvo commented 7 months ago

I had just a brief look.

If we assume that the filter can be invoked while running (why else would we 'lock?), then we should:

   (setf (slot-value connection 'message-cache) (substring (slot-value connection 'message-cache) data-len))

at the end, instead of setting possibly outdated cache. This should happen just before releasing the 'lock. (Or will the process sentinel (and therefore xcb:disconnect) run immediately after the errors?).

The ;; Connection established case should not clear the 'message-cache.

Stebalien commented 7 months ago

I think that's the correct answer?