Skip to content

Commit

Permalink
Adds preserve to signal created by manipulate
Browse files Browse the repository at this point in the history
Stops issues with manipulate signals being garbage collected when they go out of scope.
Fixes #115
  • Loading branch information
JobJob committed Nov 9, 2016
1 parent 522151c commit e1259f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/manipulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

5 comments on commit e1259f1

@beOn
Copy link

@beOn beOn commented on e1259f1 Jun 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I explicitly say "using Reactive" I get "ERROR: UndefVarError: preserve not defined". Took a bit of digging to figure out where the heck the preserve function was supposed to come from.

@JobJob
Copy link
Member Author

@JobJob JobJob commented on e1259f1 Jun 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers. Was this in IJulia on julia 0.6? what version of IJulia are you using?

@beOn
Copy link

@beOn beOn commented on e1259f1 Jun 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5.0 (sorry for not including this in the first place)

I... well dangit, now that I've explicitly imported Reactive once, I can no longer reproduce the error. Perhaps I'd never precompiled it before? Not sure.

@JobJob
Copy link
Member Author

@JobJob JobJob commented on e1259f1 Jun 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I kinda thought that would be unlikely to be happening in general. But yeah, occasionally I see bugs like this (that I can never reproduce!) when I change versions of dependent packages. Anyway, glad it's working for you now.

@beOn
Copy link

@beOn beOn commented on e1259f1 Jun 14, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.