Merge branch 'master' into cairocanvas
[ardour.git] / libs / canvas / item.cc
index da551fade6e5609b930d6f11bfd666cf5a7c04e0..569d03f81f9fb8198a55aeb96426e6b7576ce1b9 100644 (file)
@@ -70,13 +70,13 @@ Item::init ()
 
 Item::~Item ()
 {
-       if (_canvas) {
-               _canvas->item_going_away (this, _bounding_box);
-       }
-       
        if (_parent) {
                _parent->remove (this);
        }
+
+       if (_canvas) {
+               _canvas->item_going_away (this, _bounding_box);
+       }
 }
 
 ArdourCanvas::Rect
@@ -236,13 +236,14 @@ Item::parent_to_item (ArdourCanvas::Rect const & d) const
 void
 Item::unparent ()
 {
-       _canvas = 0;
        _parent = 0;
 }
 
 void
 Item::reparent (Group* new_parent)
 {
+       assert (_canvas == _parent->canvas());
+
        if (_parent) {
                _parent->remove (this);
        }
@@ -370,7 +371,7 @@ Item::dump (ostream& o) const
 {
        boost::optional<ArdourCanvas::Rect> bb = bounding_box();
 
-       o << _canvas->indent() << whatami() << ' ' << this;
+       o << _canvas->indent() << whatami() << ' ' << this << " Visible ? " << _visible;
        o << " @ " << position();
        
 #ifdef CANVAS_DEBUG