]> git.tdb.fi Git - r2c2.git/commitdiff
Delete auxiliary objects together with Vehicle3D
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Jun 2013 19:41:02 +0000 (22:41 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Jun 2013 19:41:02 +0000 (22:41 +0300)
source/3d/vehicle.cpp

index 38e2fb5ffc902223d1a022bf7ae91fac98d58cae..106be97d3c5be4c5ed49997362d314a4f2a412db 100644 (file)
@@ -64,11 +64,20 @@ Vehicle3D::~Vehicle3D()
        layout.remove_vehicle(*this);
        layout.get_scene().remove(*this);
        for(vector<Axle3D *>::iterator i=axles.begin(); i!=axles.end(); ++i)
+       {
+               layout.get_scene().remove(**i);
                delete *i;
+       }
        for(vector<Bogie3D *>::iterator i=bogies.begin(); i!=bogies.end(); ++i)
+       {
+               layout.get_scene().remove(**i);
                delete *i;
+       }
        for(vector<Rod3D *>::iterator i=rods.begin(); i!=rods.end(); ++i)
+       {
+               layout.get_scene().remove(**i);
                delete *i;
+       }
 }
 
 Vector Vehicle3D::get_node() const