{"action":"created","issue":{"url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/91","labels_url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/91/comments","events_url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/91/events","html_url":"https://github.com/gtk2hs/gtk2hs/pull/91","id":57700980,"number":91,"title":"Fix freeze when using threaded RTS on windows","user":{"login":"wrvn","id":3451153,"avatar_url":"https://avatars.githubusercontent.com/u/3451153?v=3","gravatar_id":"","url":"https://api.github.com/users/wrvn","html_url":"https://github.com/wrvn","followers_url":"https://api.github.com/users/wrvn/followers","following_url":"https://api.github.com/users/wrvn/following{/other_user}","gists_url":"https://api.github.com/users/wrvn/gists{/gist_id}","starred_url":"https://api.github.com/users/wrvn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wrvn/subscriptions","organizations_url":"https://api.github.com/users/wrvn/orgs","repos_url":"https://api.github.com/users/wrvn/repos","events_url":"https://api.github.com/users/wrvn/events{/privacy}","received_events_url":"https://api.github.com/users/wrvn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-14T18:00:23Z","updated_at":"2015-02-21T22:03:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/gtk2hs/gtk2hs/pulls/91","html_url":"https://github.com/gtk2hs/gtk2hs/pull/91","diff_url":"https://github.com/gtk2hs/gtk2hs/pull/91.diff","patch_url":"https://github.com/gtk2hs/gtk2hs/pull/91.patch"},"body":"There is a bug on Windows with recent versions of gtk (tested with 2.24.24, 2.24.25 and 3.14.8) that causes whole application to freeze when moving window. Also its mentioned here https://github.com/gtk2hs/gtk2hs/issues/33.\r\n\r\nThe underlying issue is somewhere deep in gtk callback hell where gdk_threads_enter() is getting called twice resulting in deadlock.\r\n\r\nThe only reason this issue is not observed in non threaded programs is becaue gdk_threads_init() is only called when compiling with -threaded.\r\n\r\nThis workaround simply replaces default gdk locking functions that use nonrecursive mutex with those that use recursive one.\r\n\r\nAlso here is simple c program that demonstrates this issue http://pastebin.com/5Gz2KdmA."},"comment":{"url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/comments/75395460","html_url":"https://github.com/gtk2hs/gtk2hs/pull/91#issuecomment-75395460","issue_url":"https://api.github.com/repos/gtk2hs/gtk2hs/issues/91","id":75395460,"user":{"login":"emmanueltouzery","id":339433,"avatar_url":"https://avatars.githubusercontent.com/u/339433?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanueltouzery","html_url":"https://github.com/emmanueltouzery","followers_url":"https://api.github.com/users/emmanueltouzery/followers","following_url":"https://api.github.com/users/emmanueltouzery/following{/other_user}","gists_url":"https://api.github.com/users/emmanueltouzery/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanueltouzery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanueltouzery/subscriptions","organizations_url":"https://api.github.com/users/emmanueltouzery/orgs","repos_url":"https://api.github.com/users/emmanueltouzery/repos","events_url":"https://api.github.com/users/emmanueltouzery/events{/privacy}","received_events_url":"https://api.github.com/users/emmanueltouzery/received_events","type":"User","site_admin":false},"created_at":"2015-02-21T22:03:18Z","updated_at":"2015-02-21T22:03:18Z","body":"I mentioned in issue #33 having the problem. I now rebuilt my program for windows.\r\nFirst I rebuilt it with the gtk3 package without the fix and sure enough, freeze when I attempt the resize the window.\r\nThen I applied the fix. No more freeze! I then did a basic testing of the application, and it does appear to perform correctly the multithreading, that means with correct performance unlike what I was getting when disabling the threaded RTS.\r\n\r\nSo I'm pretty sure the fix is correct and fixes completely the problem! I'll keep tuning my app for windows now that a port is finally possible and write here if I find something strange but I am certain I won't. Great work, thanks and I hope this gets merged ASAP!\r\n\r\nMaybe @cchantep wants to check too, as he was active in the issue #33 and maybe he didn't notice this PR?"}}