jutaro:
This is the first answer I got from the gtk2hs mailing list. Please consider
this issue seriously.

Well there is a simple fix as Simon Marlow wrote,
The fix is fiarly easy: use Foreign.Concurrent.mkForeignPtr with a foreign import.

In fact, if as Axel writes, these finalisers are Haskell functions that are exported using foreign import wrapper, then using Foreign.Concurrent.mkForeignPtr is actually the *simpler* thing to do (you don't need any wrapping and exporting).

Manuel

Axel Simon wrote:


Phew,

I think we're doomed. We have many, many little methods that take a
user-given function, wrap it into a foreign export wrapper which is
freed by using an on-destroy callback to Haskell. These functions are
most likely installed into some widgets (or other reference-counted
objects) that will be eventually destroyed by the Haskell garbage
collector. So, basically, we can't easily change Gtk2Hs. It will
involve many modifications. I can understand that not allowing
callbacks during GC is a great simplification in the runtime but it
seemed to be common practice to free Stable and function pointers
from within Haskell using a callback.

So, unless I'm wrong on why finalizers call back into Haskell land,
then this means that Gtk2Hs is fundamentally broken for the
foreseeable future.

Axel.

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to