[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 bd1d617: Avoid race in rcirc process filter (bug#
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-26 bd1d617: Avoid race in rcirc process filter (bug#33145) |
Date: |
Sat, 3 Nov 2018 04:47:27 -0400 (EDT) |
branch: emacs-26
commit bd1d61753d90ef47af1e9a3b7a92ee77b7d43ed0
Author: Basil L. Contovounesios <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid race in rcirc process filter (bug#33145)
* lisp/net/rcirc.el (rcirc-filter): Clear rcirc-process-output
before processing its constituent lines. Otherwise, if rcirc-filter
runs again before the last rcirc-process-server-response is
finished, the contents of rcirc-process-output could be duplicated.
---
lisp/net/rcirc.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index c09bff7..f57f755 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -753,12 +753,12 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS
and LINE.")
(with-rcirc-process-buffer process
(setq rcirc-last-server-message-time (current-time))
(setq rcirc-process-output (concat rcirc-process-output output))
- (when (= (aref rcirc-process-output
- (1- (length rcirc-process-output))) ?\n)
- (mapc (lambda (line)
- (rcirc-process-server-response process line))
- (split-string rcirc-process-output "[\n\r]" t))
- (setq rcirc-process-output nil))))
+ (when (= ?\n (aref rcirc-process-output
+ (1- (length rcirc-process-output))))
+ (let ((lines (split-string rcirc-process-output "[\n\r]" t)))
+ (setq rcirc-process-output nil)
+ (dolist (line lines)
+ (rcirc-process-server-response process line))))))
(defun rcirc-reschedule-timeout (process)
(with-rcirc-process-buffer process
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 bd1d617: Avoid race in rcirc process filter (bug#33145),
Eli Zaretskii <=