From: Toni C. <an...@gm...> - 2012-08-17 13:27:30
|
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 <http://stackoverflow.com/questions/12002814/how-to-deal-with-application-state-in-gtk2hs> in SO. Maybe there is a better approach rather than using MVars and IORefs? |