summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slv2_internal.h1
-rw-r--r--src/world.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 4e8c8da..e2a6ee1 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -136,6 +136,7 @@ void slv2_plugin_classes_free();
/** Model of LV2 (RDF) data loaded from bundles.
*/
struct _SLV2World {
+ bool local_world;
librdf_world* world;
librdf_storage* storage;
librdf_model* model;
diff --git a/src/world.c b/src/world.c
index d3776e5..26ca852 100644
--- a/src/world.c
+++ b/src/world.c
@@ -37,6 +37,8 @@ slv2_world_new()
world->world = librdf_new_world();
if (!world->world)
goto fail;
+
+ world->local_world = true;
librdf_world_open(world->world);
@@ -87,7 +89,11 @@ slv2_world_new_using_rdf_world(librdf_world* rdf_world)
SLV2World world = (SLV2World)malloc(sizeof(struct _SLV2World));
world->world = rdf_world;
+ if (!world->world)
+ goto fail;
+ world->local_world = false;
+
world->storage = librdf_new_storage(world->world, "hashes", NULL,
"hash-type='memory'");
if (!world->storage)
@@ -155,7 +161,9 @@ slv2_world_free(SLV2World world)
librdf_free_storage(world->storage);
world->storage = NULL;
- librdf_free_world(world->world);
+ if (world->local_world)
+ librdf_free_world(world->world);
+
world->world = NULL;
if (world->rdf_unlock)