[Fencommits] fenfire-hs: fix a race condition (bug in gtk?) of windowRemoveAccelGroup by employing a fake AccelGroup instead

Tuukka Hastrup Tuukka.Hastrup at iki.fi
Thu Feb 15 20:56:30 EET 2007


Thu Feb 15 20:24:02 EET 2007  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * fix a race condition (bug in gtk?) of windowRemoveAccelGroup by employing a fake AccelGroup instead
diff -rN -u old-fenfire-hs/Fenfire.fhs new-fenfire-hs/Fenfire.fhs
--- old-fenfire-hs/Fenfire.fhs	2007-02-15 20:56:29.000000000 +0200
+++ new-fenfire-hs/Fenfire.fhs	2007-02-15 20:56:29.000000000 +0200
@@ -713,12 +713,12 @@
 
     onFocusIn canvas $ \_event -> do 
         modifyIORef stateRef $ \s -> s { fsHasFocus = True }
-        windowAddAccelGroup window bindings
+        forM_ bindingActions $ actionConnectAccelerator
         updateCanvas True
         return True
     onFocusOut canvas $ \_event -> do 
         modifyIORef stateRef $ \s -> s { fsHasFocus = False }
-        windowRemoveAccelGroup window bindings
+        forM_ bindingActions $ actionDisconnectAccelerator
         updateCanvas True
         return True
 
@@ -728,14 +728,21 @@
     windowAddAccelGroup window accelGroup
     -- bindings are active only when the canvas has the focus:
     bindings <- uiManagerNew >>= uiManagerGetAccelGroup -- XXX Gtk2Hs
+    windowAddAccelGroup window bindings
+    -- fake bindings aren't used
+    fake <- uiManagerNew >>= uiManagerGetAccelGroup -- XXX Gtk2Hs
 
     actionGroup <- actionGroupNew "main"
+    bindingGroup <- actionGroupNew "bindings"
 
     makeActions actionGroup accelGroup 
-    makeBindings actionGroup bindings
+    makeBindings bindingGroup bindings
+    makeBindings actionGroup fake
 
     actions <- actionGroupListActions actionGroup
-    forM_ actions $ \action -> do
+    bindingActions <- actionGroupListActions bindingGroup
+
+    forM_ (actions ++ bindingActions) $ \action -> do
         name <- actionGetName action
         onActionActivate action $ canvasAction name >> return ()
 




More information about the Fencommits mailing list