[xmonad] Segmentation fault in fromMessage

Nathaniel Filardo nwfilardo at gmail.com
Fri Feb 11 19:20:27 CET 2011


I'm defining a LayoutModifier which handles a message:

> data SLS sl a = SLS !String !(Maybe ScreenId) !sl !Bool
>  deriving (Show,Read)
> data SLSSetScreen = SLSSS (Maybe String) (Maybe ScreenId)
>  deriving (Show,Read,Typeable)
> instance Message SLSSetScreen
> instance (Read (sl a), LayoutClass sl a)
>      => LLM.LayoutModifier (SLS (sl a)) a where
> -- ...
>     handleMess (SLS t _ sl _) m
>     | Just (SLSSS mt mns) <- fromMessage m = do
>      io $ putStrLn (show mt)
>      return Nothing

Sending this a message like so triggers a segmentation fault:

> broadcastMessage (SLSSS (Just "foo") (Just 0))

The fault occurs within Maybe's show function, according to gdb, but
beyond that I'm not sure what to test.  At least this trivial
round-trip gives the correct results at a GHCI prompt or when
compiled:

>  let x :: Maybe SLSSetScreen = fromMessage $ SomeMessage (SLSSS (Just "") (Just 0)) in show x

This is using a stock Debian GHC
> The Glorious Glasgow Haskell Compilation System, version 6.12.1
and a few patches to xmonad (notably, to enable the threaded runtime,
but I only spawn off threads that manipulate MVars, nothing near X11
nor this particular component; the full set of patches can be seen at
https://github.com/nwf/xconfig/blob/0069880d1389b6e94fa2254073a6b8fb80f9b827/xmonad/outstanding-contribs.dpatch
and
https://github.com/nwf/xconfig/blob/0069880d1389b6e94fa2254073a6b8fb80f9b827/xmonad/outstanding.dpatch
)

Any help would be greatly appreciated.
Thanks much.
--nwf;



More information about the xmonad mailing list