Fix a situation where behaviors can be garbage collected if 'sample' gets aggressively inlined
commitf5f886f4a572a973c0e8124e7c559473777a133d
authorRyan Trinkle <ryan.trinkle@gmail.com>
dateTue 24 Oct 2017, 10:42 (9 years ago)
parentd9ef845
src/Reflex/Spider/Internal.hs+1
@@ -699,6 +699,7 @@ readHoldTracked h = do
699699 result <- liftIO $ readIORef $ holdValue h
700700 askInvalidator >>= mapM_ (\wi -> liftIO $ modifyIORef' (holdInvalidators h) (wi:))
701701 askParentsRef >>= mapM_ (\r -> liftIO $ modifyIORef' r (SomeBehaviorSubscribed (BehaviorSubscribedHold h) :))
702+ liftIO $ touch h -- Otherwise, if this gets inlined enough, the hold's parent reference may get collected
702703 return result
703704
704705{-# INLINABLE readBehaviorUntracked #-}