mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 09:21:37 -05:00
Fix: (ement-room--m.image-callback) Workaround rare bug
I'm not sure what can cause this. While I've heard a couple of reports from users, this is the first time it's happened to me. It might be caused by an earlier error interrupting sync processing, leaving a room data or buffer in an inconsistent state. Anyway, this should prevent it from being a problem, while still leaving a way to potentially learn the cause so it can be truly solved.
This commit is contained in:
parent
033e155061
commit
2253e97753
1 changed files with 11 additions and 3 deletions
|
@ -3761,9 +3761,17 @@ Then invalidate EVENT's node to show the image."
|
||||||
(setf (map-elt (ement-event-local event) 'image) data)
|
(setf (map-elt (ement-event-local event) 'image) data)
|
||||||
(when (buffer-live-p buffer)
|
(when (buffer-live-p buffer)
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(ewoc-invalidate ement-ewoc (ement-room--ewoc-last-matching ement-ewoc
|
(if-let (node (ement-room--ewoc-last-matching ement-ewoc
|
||||||
(lambda (node-data)
|
(lambda (node-data)
|
||||||
(eq node-data event))))))))
|
(eq node-data event))))
|
||||||
|
(ewoc-invalidate ement-ewoc node)
|
||||||
|
;; This shouldn't happen, but very rarely, it can. I haven't figured out why
|
||||||
|
;; yet, so checking whether a node is found rather than blindly calling
|
||||||
|
;; `ewoc-invalidate' prevents an error from aborting event processing.
|
||||||
|
(display-warning 'ement-room--m.image-callback
|
||||||
|
(format "Event %S not found in room %S (a very rare, as-yet unexplained bug, which can be safely ignored; you may disconnect and reconnect if you wish, but it isn't strictly necessary)"
|
||||||
|
(ement-event-id event)
|
||||||
|
(ement-room-display-name room))))))))
|
||||||
|
|
||||||
(defun ement-room--format-m.file (event)
|
(defun ement-room--format-m.file (event)
|
||||||
"Return \"m.file\" EVENT formatted as a string."
|
"Return \"m.file\" EVENT formatted as a string."
|
||||||
|
|
Loading…
Add table
Reference in a new issue