addListener finalizers (or more specifically: finalizers associated with their wl_listeners) get called early in hsroots, causing compositors to freeze. Here is a minimum reproducible example:
outputFrameNotify :: WlListener WlrOutput
outputFrameNotify = WlListener $ \ptrWlrOutput ->
do now <- getTime Realtime
putStrLn (show now) --- <-- This pauses after a few seconds due to an early finalizer call
newOutputNotify :: WlListener WlrOutput
newOutputNotify = WlListener $ \ptrWlrOutput ->
do let outputSignals = getOutputSignals ptrWlrOutput
let frameSignal = outSignalFrame outputSignals
addListener outputFrameNotify frameSignal
return ()
main :: IO ()
main = do displayServer <- displayCreate
eventLoop <- displayGetEventLoop displayServer
ptrBackend <- backendAutocreate displayServer
let newOutputSignal = (backendEvtOutput $ backendGetSignals ptrBackend) :: Ptr (WlSignal WlrOutput)
addListener newOutputNotify newOutputSignal
backendStart ptrBackend
displayRun displayServer
displayDestroy displayServer
addListenerfinalizers (or more specifically: finalizers associated with their wl_listeners) get called early in hsroots, causing compositors to freeze. Here is a minimum reproducible example: