From cc8f467e99dafded9efb924dacebcb8a53473ec4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Jan 2012 19:00:14 +0000 Subject: Fix errors on canvas and/or edge destruction. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3941 a436a847-0d15-0410-975c-d299462d15a1 --- src/Canvas.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Canvas.cpp b/src/Canvas.cpp index febc671..e8484ad 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -598,7 +598,6 @@ GanvCanvasImpl::remove_edge(GanvEdge* edge) _selected_edges.erase(edge); _edges.erase(edge); _dst_edges.erase(edge); - gtk_object_destroy(GTK_OBJECT(edge)); } } @@ -1478,13 +1477,16 @@ Canvas::destroy() FOREACH_ITEM(items, i) { gtk_object_destroy(GTK_OBJECT(*i)); } + impl()->_items.clear(); + GanvCanvasImpl::Edges edges = impl()->_edges; // copy + FOREACH_EDGE(edges, i) { + gtk_object_destroy(GTK_OBJECT(*i)); + } impl()->_edges.clear(); impl()->_selected_ports.clear(); impl()->_connect_port = NULL; - - impl()->_items.clear(); } void @@ -1503,7 +1505,7 @@ Canvas::remove_edge(Node* item1, { Edge* edge = get_edge(item1, item2); if (edge) { - impl()->remove_edge(edge->gobj()); + gtk_object_destroy(GTK_OBJECT(edge->gobj())); } } -- cgit v1.2.1