hsSDL2
hsSDL2 copied to clipboard
Haskell RTS frees glContext prematurely
The problem: when writing a HsSDL2 code that uses OpenGL, no GL update gets displayed after a few frames.
Tha cause is that currently glContext is a ForeignPtr, which has a finalizer, that calls SDL_GL_DeleteContext
when the Haskell RTS has no reference to the pointer. Unfortunately since we don't use this pointer explicitly in the code after we create it with glCreateContext
, Haskell RTS frees it after some time. (Using touchForeignPtr
will prevent the RTS from calling the finalizer.)