blob: 341fd2e5d2940397e1658cddc259db79d8b7168a [file] [log] [blame]
--- o3d/core/cross/element.cc (revision 193397)
+++ o3d/core/cross/element.cc (working copy)
@@ -63,6 +63,11 @@
}
Element::~Element() {
+ // Unregister any DrawElements that might think they own us.
+ DrawElementRefArray::iterator iter, end = draw_elements_.end();
+ for (iter = draw_elements_.begin(); iter != end; ++iter) {
+ iter->Get()->SetOwner(0);
+ }
}
void Element::SetOwner(Shape* new_owner) {
--- o3d/core/cross/shape.h (revision 193397)
+++ o3d/core/cross/shape.h (working copy)
@@ -55,6 +55,8 @@
public:
typedef SmartPointer<Shape> Ref;
+ virtual ~Shape();
+
// Gets an Array of Elements in this shape.
// Returns:
// ElementArray of elements in this shape.
--- o3d/core/cross/shape.cc (revision 193397)
+++ o3d/core/cross/shape.cc (working copy)
@@ -44,6 +44,14 @@
: ParamObject(service_locator) {
}
+Shape::~Shape() {
+ // Unregister any Elements that might think they own us.
+ ElementRefArray::iterator iter, end = elements_.end();
+ for (iter = elements_.begin(); iter != end; ++iter) {
+ iter->Get()->SetOwner(0);
+ }
+}
+
ObjectBase::Ref Shape::Create(ServiceLocator* service_locator) {
return ObjectBase::Ref(new Shape(service_locator));
}