summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-04-22 02:26:26 +0300
committerdefanor <defanor@uberspace.net>2018-04-22 02:26:26 +0300
commitf9d699facc2a48022d44a67b6ef8eb76a6ca1233 (patch)
tree982cb57ef58f0d57360e9826599039919b81e162
parent65668579e840b1587f7b70d0e44e11bc8ba08369 (diff)
downloadredland-f9d699facc2a48022d44a67b6ef8eb76a6ca1233.zip
redland-f9d699facc2a48022d44a67b6ef8eb76a6ca1233.tar.gz
redland-f9d699facc2a48022d44a67b6ef8eb76a6ca1233.tar.bz2
Fix an occasional segfault
Not sure why it happens, but calls to raptor_free_uri via finalizers led to segfaults, and it helped to call a finalizer manually from statementToTriple.
-rw-r--r--Redland/Util.hs8
-rw-r--r--redland.cabal2
2 files changed, 7 insertions, 3 deletions
diff --git a/Redland/Util.hs b/Redland/Util.hs
index 0940cfc..c7862be 100644
--- a/Redland/Util.hs
+++ b/Redland/Util.hs
@@ -84,7 +84,7 @@ redlandNodeToNode rn = do
(_, Just t) -> Just . XMLSchema <$> uriAsString t
_ -> pure Nothing
pure $ LiteralNode litVal nType
- _ -> ResourceNode <$> (nodeGetURI rn >>= uriAsString)
+ _ -> ResourceNode <$> withNew (nodeGetURI rn) uriAsString
-- | A conversion function.
nodeToRedlandNode :: ForeignPtr RedlandWorld
@@ -186,7 +186,11 @@ statementToTriple statement = do
componentToTriple f = do
c <- f statement
case c of
- Just c' -> Just <$> redlandNodeToNode c'
+ Just c' -> do
+ n <- redlandNodeToNode c'
+ -- segfaulting without finalization here, not sure why.
+ finalizeForeignPtr c'
+ pure $ Just n
Nothing -> pure Nothing
-- | A conversion function.
diff --git a/redland.cabal b/redland.cabal
index 9661cf7..982dfd4 100644
--- a/redland.cabal
+++ b/redland.cabal
@@ -1,5 +1,5 @@
name: redland
-version: 0.2.0.1
+version: 0.2.0.2
synopsis: Redland RDF library bindings
description: This package provides low-level and mid-level
Redland RDF library bindings, as well as some