I succeeded in replacing finalized Addrs with ForeignObjs, but probably
weak pointers were the problem (and were really unnecessary). Now it
only sometimes crashes at Ctrl-C. The following progam does so too
(about 1/10 of runs):
------------------------------------------------------------------------
import Addr
import Foreign
import IO
main:: IO ()
main = do
hSetBuffering stdout NoBuffering
sequence_ . repeat $ do
fo <- malloc 100 >>= mkForeignObj
addForeignFinalizer fo (putStrLn "finalizer" >> free fo)
putStrLn "x"
foreign import malloc :: Int -> IO Addr
foreign import free :: ForeignObj -> IO ()
------------------------------------------------------------------------
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-