racket/sandbox: fix guard on attempt to flush sandbox plumber

This commit is contained in:
Matthew Flatt 2014-05-09 16:27:04 -06:00
parent 7987740d18
commit 5c521961b5
2 changed files with 26 additions and 1 deletions

View File

@ -666,6 +666,26 @@
r1) r1)
(test #t equal? r1 r2)) (test #t equal? r1 r2))
;; ----------------------------------------
;; Check that sandbox is not flushed if
;; its custodian has been shut down:
(let ()
(define p (make-plumber))
(define e0
(parameterize ([current-plumber p])
(call-with-trusted-sandbox-configuration
(lambda ()
(make-evaluator 'racket/base)))))
(e0 '(require racket/sandbox))
(e0 '(make-evaluator 'racket/base))
(kill-evaluator e0)
;; e's plumber should not be flushed:
(plumber-flush-all p))
;; ---------------------------------------- ;; ----------------------------------------
;; Backup test for one in "thread.rktl", since this sandbox test ;; Backup test for one in "thread.rktl", since this sandbox test

View File

@ -1032,7 +1032,12 @@
(let ([p (make-plumber)]) (let ([p (make-plumber)])
(define fh (plumber-add-flush! (current-plumber) (define fh (plumber-add-flush! (current-plumber)
(lambda (fh) (lambda (fh)
(unless terminated? (unless (or terminated?
;; The evaluator thread may have terminated
;; asynchronously, such as through an enclosing
;; custodian's shutdown
(and user-thread
(thread-dead? user-thread)))
(call-in-sandbox-context (call-in-sandbox-context
evaluator evaluator
(lambda () (lambda ()