Skip to content

Commit

Permalink
view,container: work harder to avoid retaining things
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Jul 10, 2022
1 parent bc32f04 commit bebc226
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions gui-easy-lib/gui/easy/private/view/container.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
(init-field children)
(super-new)

(define deps-to-children
(for*/fold ([h (hash)])
([c (in-list children)]
[d (in-list (send c dependencies))])
(hash-update h d (λ (cs) (cons c cs)) null)))
(define deps-to-children (make-hash))
(for* ([c (in-list children)]
[d (in-list (send c dependencies))])
(hash-update! deps-to-children d (λ (cs) (cons c cs)) null))

(define/public (child-dependencies)
(hash-keys deps-to-children))
Expand All @@ -26,7 +25,10 @@
(define/public (destroy-children)
(for ([(c w) (in-hash children-to-widgets)])
(send c destroy w)
(remove-child c)))
(remove-child c))
(hash-clear! deps-to-children)
(hash-clear! children-to-widgets)
(set! children null))

(define children-to-widgets (make-hasheq))

Expand Down

0 comments on commit bebc226

Please sign in to comment.