From d05d7e4267eca39d8d54fb0d199a450b364b77c3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Dec 2013 05:47:26 +0000 Subject: Fix crash on bulk deletion and AtomWriter forge errors. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5240 a436a847-0d15-0410-975c-d299462d15a1 --- src/AtomWriter.cpp | 6 ++++++ src/client/ClientStore.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index 7afd6056..8b2d90c5 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -14,6 +14,7 @@ along with Ingen. If not, see . */ +#include #include #include "ingen/AtomSink.hpp" @@ -58,6 +59,7 @@ AtomWriter::AtomWriter(URIMap& map, URIs& uris, AtomSink& sink) void AtomWriter::finish_msg() { + assert(!_forge.stack); _sink.write((const LV2_Atom*)_out.buf); _out.len = 0; } @@ -174,6 +176,8 @@ AtomWriter::move(const Raul::Path& old_path, forge_uri(Node::path_to_uri(old_path)); lv2_atom_forge_property_head(&_forge, _uris.patch_destination, 0); forge_uri(Node::path_to_uri(new_path)); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); } void @@ -183,6 +187,8 @@ AtomWriter::del(const Raul::URI& uri) lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); forge_uri(uri); + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); } void diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 9882d2d5..56c74cd8 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -105,12 +105,13 @@ ClientStore::remove_object(const Raul::Path& path) return SPtr(); } + SPtr object = dynamic_ptr_cast(top->second); + // Remove the object and all its descendants Objects removed; remove(top, removed); // Notify everything that needs to know this object is going away - SPtr object = dynamic_ptr_cast(top->second); if (object) { // Notify the program this object is going away object->signal_destroyed().emit(); -- cgit v1.2.1