summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-25 06:07:21 +0000
committerDavid Robillard <d@drobilla.net>2007-07-25 06:07:21 +0000
commit66a7b635331baaa483ba3cc27aef6c244f9a98df (patch)
tree5a743732458a5ee194f12917b9f9479d42f3afa4 /src
parent9f43f23510ba2acd8e03f2822d87c74a8774b9d6 (diff)
downloadlilv-66a7b635331baaa483ba3cc27aef6c244f9a98df.tar.gz
lilv-66a7b635331baaa483ba3cc27aef6c244f9a98df.tar.bz2
lilv-66a7b635331baaa483ba3cc27aef6c244f9a98df.zip
Don't call librdf_free_world if world was passed by called using slv2_world_new_using_rdf_world.
git-svn-id: http://svn.drobilla.net/lad/slv2@623 a436a847-0d15-0410-975c-d299462d15a1
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)