From 335a1d44d481054d31c1fc5d5acaf16654bcc664 Mon Sep 17 00:00:00 2001 From: Joel Mason Date: Fri, 4 Nov 2016 23:31:50 +1100 Subject: [PATCH] Adds preserve to signal created by manipulate Stops issues with manipulate signals being garbage collected when they go out of scope. Fixes #115 --- src/manipulate.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/manipulate.jl b/src/manipulate.jl index 948df64..ffd470c 100644 --- a/src/manipulate.jl +++ b/src/manipulate.jl @@ -16,7 +16,7 @@ end function map_block(block, symbols) lambda = Expr(:(->), Expr(:tuple, symbols...), block) - :(map($lambda, $(map(s->:(signal($s)), symbols)...), typ=Any)) + :(preserve(map($lambda, $(map(s->:(signal($s)), symbols)...), typ=Any))) end function symbols(bindings) @@ -36,7 +36,7 @@ macro manipulate(expr) end syms = symbols(bindings) Expr(:let, Expr(:block, - display_widgets(syms)..., - esc(map_block(block, syms))), - map(make_widget, bindings)...) + display_widgets(syms)..., + esc(map_block(block, syms))), + map(make_widget, bindings)...) end