on develop help sign in
Bang patterns no longer work for ensuring we're making the right Weak references on GHC 8
commite876aaaa98bf0b7fd2ba31dacdc756abce56ea54 authorRyan Trinkle <ryan.trinkle@gmail.com> dateMon 25 Apr 2016, 08:32 (10 years ago) parent8397284
1 file changed+3−2
src/Reflex/Spider/Internal.hs+3−2
src/Reflex/Spider/Internal.hs+3−2
@@ -23,6 +23,7 @@ import Control.Monad.Ref
2323import Control.Monad.Exception
2424import Data.Monoid ((<>))
2525import Data.Coerce
26+import Control.Exception
2627
2728import System.IO.Unsafe
2829import Unsafe.Coerce
@@ -1107,12 +1108,12 @@ runFrame a = do
11071108 finalize wsub
11081109 wi <- readIORef $ switchSubscribedOwnWeakInvalidator subscribed
11091110 finalize wi
1110− let !i = switchSubscribedOwnInvalidator subscribed
1111+ i <- evaluate $ switchSubscribedOwnInvalidator subscribed
11111112 wi' <- mkWeakPtrWithDebug i "wi'"
11121113 writeIORef (switchSubscribedBehaviorParents subscribed) []
11131114 e <- runBehaviorM (readBehaviorTracked (switchSubscribedParent subscribed)) (Just (wi', switchSubscribedBehaviorParents subscribed))
11141115 --TODO: Make sure we touch the pieces of the SwitchSubscribed at the appropriate times
1115− let !sub = switchSubscribedSelf subscribed -- Must be done strictly, or the weak pointer will refer to a useless thunk
1116+ sub <- evaluate $ switchSubscribedSelf subscribed -- Must be done strictly, or the weak pointer will refer to a useless thunk
11161117 wsub' <- mkWeakPtrWithDebug sub "wsub'"
11171118 writeIORef (switchSubscribedSelfWeak subscribed) wsub'
11181119 subd' <- runFrame $ subscribe e $ WeakSubscriberSimple wsub' --TODO: Assert that the event isn't firing --TODO: This should not loop because none of the events should be firing, but still, it is inefficient