added a watcher thread to check on animated gif creation

This commit is contained in:
Matthias Felleisen 2014-09-02 12:13:22 +02:00
parent a96b45be9c
commit ae2dcdeb9e

View File

@ -451,7 +451,22 @@
(define p (new horizontal-pane% [parent frm][alignment '(center center)])) (define p (new horizontal-pane% [parent frm][alignment '(center center)]))
(define (pb) (define (pb)
(parameterize ([current-custodian play-back-custodian]) (parameterize ([current-custodian play-back-custodian])
(thread (lambda () (play-back))) (define done #false)
(define pb-thread
(thread
(lambda ()
(dynamic-wind void
(lambda () (play-back))
(lambda () (set! done #true))))))
(define watcher
(thread
(lambda ()
(sync pb-thread)
(if done
(custodian-shutdown-all play-back-custodian)
(message-box
"Error"
"The creation of the animated gif failed, probably due to a lack of memory")))))
(stop))) (stop)))
(define (switch) (define (switch)
(send stop-button enable #f) (send stop-button enable #f)
@ -518,7 +533,7 @@
(cond (cond
[(or (empty? lox) (empty? (rest lox))) (map second lox)] [(or (empty? lox) (empty? (rest lox))) (map second lox)]
[else [else
;; -----------------------------------------------------------------------------x ;; -----------------------------------------------------------------------------
(define raw-times (map first lox)) (define raw-times (map first lox))
(define intervals (define intervals
(let loop ([l (rest raw-times)][last (first raw-times)]) (let loop ([l (rest raw-times)][last (first raw-times)])