free_ref & free_me in PgfMarshaller too

This commit is contained in:
krangelov
2021-08-14 20:08:04 +02:00
parent 9db352b2bb
commit 8b8028bdfe
3 changed files with 22 additions and 3 deletions

View File

@@ -244,9 +244,13 @@ foreign import ccall "dynamic"
foreign import ccall "wrapper"
wrapDTypFun :: DTypFun -> IO (FunPtr DTypFun)
foreign import ccall "&hs_free_reference" hs_free_reference :: FunPtr (Ptr PgfUnmarshaller -> StablePtr a -> IO ())
foreign import ccall "&hs_free_reference" hs_free_reference :: FunPtr (Ptr a -> StablePtr a -> IO ())
foreign import ccall "&hs_free_unmarshaller" hs_free_unmarshaller :: FunPtr (Ptr PgfUnmarshaller -> IO ())
foreign import ccall "&hs_free_marshaller" hs_free_marshaller :: FinalizerPtr PgfMarshaller
foreign import ccall "hs_free_marshaller" freeMarshaller :: Ptr PgfMarshaller -> IO ()
foreign import ccall "&hs_free_unmarshaller" hs_free_unmarshaller :: FinalizerPtr PgfUnmarshaller
foreign import ccall "hs_free_unmarshaller" freeUnmarshaller :: Ptr PgfUnmarshaller -> IO ()
@@ -260,6 +264,8 @@ mkMarshaller = do
wrapMatchFun matchLit >>= (#poke PgfMarshallerVtbl, match_lit) vtbl
wrapMatchFun matchExpr >>= (#poke PgfMarshallerVtbl, match_expr) vtbl
wrapMatchFun matchType >>= (#poke PgfMarshallerVtbl, match_type) vtbl
(#poke PgfMarshallerVtbl, free_ref) vtbl hs_free_reference
(#poke PgfMarshallerVtbl, free_me) vtbl hs_free_marshaller
ptr <- mallocBytes (#size PgfMarshaller)
(#poke PgfMarshaller, vtbl) ptr vtbl
return ptr