Hi,

    Instead of using IORef I'm using MVar as the main entry point to state in my Gtk2Hs application. But I'm having strange behaviours and I'm not able to identify the reason. If I write a handler for the onExpose event like:

    onExpose canvas $ \_ -> (do
                                st <- readMVar ui
                                putStrLn st
                                myPaint st drawin
                            )

everything works fine, but if instead of readMVar I use takeMVar, the application freezes and the painting code in "myPaint" doesn't show although the putStrLn was printed correctly. Does anybody know what I'm doing wrong here?

Toni.

PS. I came to this problem after posting this question in SO. Maybe there is a better approach rather than using MVars and IORefs?