From: Lars Ingebrigtsen Date: Mon, 20 Feb 2012 12:12:48 +0000 (+0100) Subject: Avoid a race condition in url-queue-kill-job X-Git-Tag: emacs-pretest-24.0.94~95 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=27e7172ced67cffd830e805d06aca9ad1324f030;p=emacs.git 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. --- 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 @@ 2012-02-20 Lars Ingebrigtsen + * 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. + * url.el (url-retrieve-internal): Warn about file errors when pruning the cache instead of bugging out (bug#10831). 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." (defun url-queue-kill-job (job) (when (bufferp (url-queue-buffer job)) - (while (get-buffer-process (url-queue-buffer job)) - (ignore-errors - (delete-process (get-buffer-process (url-queue-buffer job))))) + (let (process) + (while (setq process (get-buffer-process (url-queue-buffer job))) + (set-process-sentinel process 'ignore) + (ignore-errors + (delete-process process)))) (ignore-errors (kill-buffer (url-queue-buffer job)))))