diff options
| author | Lars Ingebrigtsen | 2012-02-20 13:12:48 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2012-02-20 13:12:48 +0100 |
| commit | 27e7172ced67cffd830e805d06aca9ad1324f030 (patch) | |
| tree | 22a73a7c45930bb7c9b495776f4e7b014e92513e | |
| parent | 75a4d9cc2f182761e2be64a429ed617557811194 (diff) | |
| download | emacs-27e7172ced67cffd830e805d06aca9ad1324f030.tar.gz emacs-27e7172ced67cffd830e805d06aca9ad1324f030.zip | |
Avoid a race condition in url-queue-kill-job
* url-queue.el (url-queue-kill-job): Delete the process sentinel
before killing the process to avoid a race condition between the
two processes killing off the process buffer.
| -rw-r--r-- | lisp/url/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/url/url-queue.el | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e57b5eccbc2..55aa9194904 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-02-20 Lars Ingebrigtsen <larsi@gnus.org> | 1 | 2012-02-20 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * url-queue.el (url-queue-kill-job): Delete the process sentinel | ||
| 4 | before killing the process to avoid a race condition between the | ||
| 5 | two processes killing off the process buffer. | ||
| 6 | |||
| 3 | * url.el (url-retrieve-internal): Warn about file errors when | 7 | * url.el (url-retrieve-internal): Warn about file errors when |
| 4 | pruning the cache instead of bugging out (bug#10831). | 8 | pruning the cache instead of bugging out (bug#10831). |
| 5 | 9 | ||
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index 6456d44c423..6e4cedddaf3 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el | |||
| @@ -152,9 +152,11 @@ The variable `url-queue-timeout' sets a timeout." | |||
| 152 | 152 | ||
| 153 | (defun url-queue-kill-job (job) | 153 | (defun url-queue-kill-job (job) |
| 154 | (when (bufferp (url-queue-buffer job)) | 154 | (when (bufferp (url-queue-buffer job)) |
| 155 | (while (get-buffer-process (url-queue-buffer job)) | 155 | (let (process) |
| 156 | (ignore-errors | 156 | (while (setq process (get-buffer-process (url-queue-buffer job))) |
| 157 | (delete-process (get-buffer-process (url-queue-buffer job))))) | 157 | (set-process-sentinel process 'ignore) |
| 158 | (ignore-errors | ||
| 159 | (delete-process process)))) | ||
| 158 | (ignore-errors | 160 | (ignore-errors |
| 159 | (kill-buffer (url-queue-buffer job))))) | 161 | (kill-buffer (url-queue-buffer job))))) |
| 160 | 162 | ||