Ticket #24: CleanExitOnExcpetions.patch

File CleanExitOnExcpetions.patch, 1.5 KB (added by Thomas DuBuisson, 12 years ago)

Catch exceptions / Fix the screen resolution on exit

Line 
11 patch for repository http://code.ouroborus.net/gloss/gloss-stable:
2
3Sun Jan 22 12:55:36 PST 2012  Thomas.DuBuisson@gmail.com
4  * Exit cleanly when uncaught exceptions hit the main loop.
5
6New patches:
7
8[Exit cleanly when uncaught exceptions hit the main loop.
9Thomas.DuBuisson@gmail.com**20120122205536
10 Ignore-this: 6b8451e03a360e0890cc9647a4f44285
11] hunk ./gloss/Graphics/Gloss/Internals/Interface/Backend/GLFW.hs 15
12 import Graphics.UI.GLFW                    (WindowValue(..))
13 import qualified Graphics.UI.GLFW          as GLFW
14 import qualified Graphics.Rendering.OpenGL as GL
15-
16+import qualified Control.Excpetion         as X
17 
18 -- [Note: FreeGlut]
19 -- ~~~~~~~~~~~~~~~~
20hunk ./gloss/Graphics/Gloss/Internals/Interface/Backend/GLFW.hs 437
21         -> IO ()
22 
23 runMainLoopGLFW stateRef
24- = do   windowIsOpen <- GLFW.windowIsOpen
25-        when windowIsOpen
26-         $ do   dirty <- fmap dirtyScreen $ readIORef stateRef
27+ = X.catch go recover
28+ where
29+ recover :: SomeException -> IO ()x
30+ recover = do
31+#ifdef linux_HOST_OS
32+-- See [Note: FreeGlut] for why we need this.
33+        GLUT.exit
34+#endif
35+        return True
36+ go :: IO ()
37+ go = do windowIsOpen <- GLFW.windowIsOpen
38+         when windowIsOpen
39+          $ do  dirty <- fmap dirtyScreen $ readIORef stateRef
40 
41                 when dirty
42                  $ do   s <- readIORef stateRef
43
44Context:
45
46[TAG Release 1.6.0.1
47Ben Lippmeier <benl@ouroborus.net>**20111228020857
48 Ignore-this: 8b11cdc5e55cbaf6ecd6dddc346eed61
49]
50Patch bundle hash:
51510c91f7f1b8f8c610dc2a75c497ecd5cc19bc47