From 807627ebaac9a763255e498c7a91bd556e424bf3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Jan 2020 15:49:06 +0100 Subject: Update manifest when deleting state from a non-empty bundle This fixes a bug where the manifest would contain dangling references to old state if multiple states were saved to a single bundle and one is deleted. As far as I know this has not been encountered by anyone in reality, since this is an uncommon scenario (it's somewhat in question whether it should be supported at all). --- src/state.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index cd47fe0..5ca2205 100644 --- a/src/state.c +++ b/src/state.c @@ -1305,8 +1305,13 @@ lilv_state_delete(LilvWorld* world, state->dir, strerror(errno)); } } else { - // Still something in the manifest, reload bundle + // Still something in the manifest, update and reload bundle + const SerdNode* manifest_node = sord_node_to_serd_node(manifest->node); + SerdEnv* env = serd_env_new(manifest_node); + + write_manifest(world, env, model, manifest_node); lilv_world_load_bundle(world, bundle); + serd_env_free(env); } sord_free(model); -- cgit v1.2.1