When deleting a Model::HierNode reset the _parent of the _child.

Fixes some memory corruption when deleting costumes.
This commit is contained in:
Giulio Camuffo 2011-04-10 18:10:19 +02:00
parent 179dfccf37
commit 8323ad6f3a
2 changed files with 6 additions and 0 deletions

View File

@ -213,6 +213,11 @@ Model::Face::~Face() {
delete[] _texVertices;
}
Model::HierNode::~HierNode() {
if (_child)
_child->_parent = NULL;
}
void Model::HierNode::loadBinary(const char *&data, Model::HierNode *hierNodes, const Geoset *g) {
memcpy(_name, data, 64);
_flags = READ_LE_UINT32(data + 64);

View File

@ -53,6 +53,7 @@ public:
struct Mesh;
struct HierNode {
HierNode() : _initialized(false) { }
~HierNode();
void loadBinary(const char *&data, HierNode *hierNodes, const Geoset *g);
void draw() const;
void addChild(HierNode *child);