Skip to content

Commit 2c9c36b

Browse files
committed
Fix "stay open at end" bug for distribution.
When someone creates a distribution package the big-bang window didn't stay open because `stop!` was called too early. The docs are specifying this behavior already. I do not know right now how to write a test (other than doing it by hand, and that takes time).
1 parent 7877cc2 commit 2c9c36b

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

htdp-lib/2htdp/private/world.rkt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,24 @@
439439
;; wrap up actions
440440
(define/private (wrap-up name)
441441
(last-draw)
442-
(callback-stop! 'name)
443-
(enable-images-button)
442+
444443
;; in principle, a big-bang that specifies both
445444
;; [record? #true]
446445
;; and
447446
;; [close-on-stop #true]
448447
;; is self-contradictory; I will wait until someone complaints -- MF, 22 Nov 2015
449-
(when close-on-stop
450-
(unless (boolean? close-on-stop)
451-
(sleep close-on-stop))
452-
(send the-frame show #f)))
448+
(cond
449+
[(number? close-on-stop)
450+
(sleep close-on-stop)
451+
(send the-frame show #f)]
452+
[(false? close-on-stop)
453+
(sleep 600) ;; just wait for a long time
454+
(send the-frame show #f)]
455+
[else
456+
(send the-frame show #f)])
457+
458+
(callback-stop! 'name)
459+
(enable-images-button))
453460

454461
(define/public (callback-stop! msg)
455462
(stop! (send world get)))

0 commit comments

Comments
 (0)