@@ -81,7 +81,7 @@ import Language.Javascript.JSaddle.Types
8181import Foreign.C.Types (CSize(..), CULong(..), CUInt(..))
8282#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
8383import GHCJS.Types (nullRef, castRef, JSArray, JSFun)
84−import GHCJS.Foreign (newObj, toArray, fromArray, syncCallback2)
84+import GHCJS.Foreign (newObj, toArray, fromArray, syncCallback2, ForeignRetention(..))
8585import Control.Monad (liftM)
8686import Control.Applicative ((<$>))
8787#else
@@ -333,7 +333,7 @@ function :: MakeStringRef name
333333 -- call the Haskell one when it is called
334334#if defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)
335335function name f = liftIO $ do
336− callback <- syncCallback2 False True $ \this args -> do
336+ callback <- syncCallback2 NeverRetain True $ \this args -> do
337337 rargs <- fromArray args
338338 runReaderT (f this this rargs) () -- TODO pass function object through
339339 makeFunctionWithCallback (makeStringRef name) callback