@@ -382,7 +382,7 @@ showEventType = \case
382382 EventCoincidence _ -> "EventCoincidence"
383383
384384data EventSubscribed a
385− = EventSubscribedRoot !(RootSubscribed a)
385+ = EventSubscribedRoot {-# NOUNPACK #-} (RootSubscribed a)
386386 | EventSubscribedNever
387387 | forall b. EventSubscribedPush !(PushSubscribed b a)
388388 | forall k. (GCompare k, a ~ DMap k) => EventSubscribedMerge !(MergeSubscribed k)
@@ -765,6 +765,10 @@ subscribe e ws = do
765765 liftIO $ subscribeEventSubscribed subd ws
766766 return subd
767767
768+noinlineFalse :: Bool
769+noinlineFalse = False
770+{-# NOINLINE noinlineFalse #-}
771+
768772getRootSubscribed :: Root a -> EventM (RootSubscribed a)
769773getRootSubscribed r = do
770774 mSubscribed <- liftIO $ readIORef $ rootSubscribed r
@@ -779,6 +783,7 @@ getRootSubscribed r = do
779783 -- Strangely, init needs the same stuff as a RootSubscribed has, but it must not be the same as the one that everyone's subscribing to, or it'll leak memory
780784 uninit <- rootInit r $ RootTrigger (subscribersRef, rootOccurrence r)
781785 addFinalizer subscribed $ do
786+ when noinlineFalse $ putStr "" -- For some reason, without this line, the finalizer will run earlier than it should
782787-- putStrLn "Uninit root"
783788 uninit
784789 liftIO $ writeIORef (rootSubscribed r) $ Just subscribed