# Blender: fix memory leaking due to cycle refs. Thanks to Vitalii Trubchaninov for pointing this out.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1230 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -881,7 +881,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
|
||||
std::deque<const Object*> children;
|
||||
for(std::set<const Object*>::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) {
|
||||
const Object* object = *it;
|
||||
if (object->parent.get() == obj) {
|
||||
if (object->parent == obj) {
|
||||
children.push_back(object);
|
||||
|
||||
conv_data.objects.erase(it++);
|
||||
|
||||
+14
-6
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -18,10 +18,10 @@ following conditions are met:
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
@@ -63,7 +63,11 @@ template <> void Structure :: Convert<Object> (
|
||||
ReadFieldArray2<ErrorPolicy_Warn>(dest.obmat,"obmat",db);
|
||||
ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
|
||||
ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.parent,"*parent",db);
|
||||
{
|
||||
boost::shared_ptr<Object> parent;
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
|
||||
dest.parent = parent.get();
|
||||
}
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.track,"*track",db);
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy,"*proxy",db);
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy_from,"*proxy_from",db);
|
||||
@@ -238,7 +242,11 @@ template <> void Structure :: Convert<Base> (
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev,"*prev",db);
|
||||
{
|
||||
boost::shared_ptr<Base> prev;
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(prev,"*prev",db);
|
||||
dest.prev = prev.get();
|
||||
}
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db);
|
||||
ReadFieldPtr<ErrorPolicy_Warn>(dest.object,"*object",db);
|
||||
|
||||
|
||||
+5
-4
@@ -71,9 +71,10 @@ namespace Assimp {
|
||||
//
|
||||
// * Pointers to other structures or primitive types are allowed.
|
||||
// No references or double pointers or arrays of pointers.
|
||||
// A pointer to a T is written as boost::shared_ptr, while a
|
||||
// A pointer to a T is normally written as boost::shared_ptr, while a
|
||||
// pointer to an array of elements is written as boost::
|
||||
// shared_array.
|
||||
// shared_array. To avoid cyclic pointers, use raw pointers in
|
||||
// one direction.
|
||||
//
|
||||
// * Arrays can have maximally two-dimensions. Any non-pointer
|
||||
// type can form them.
|
||||
@@ -477,7 +478,7 @@ struct Object : ElemBase {
|
||||
float parentinv[4][4] WARN;
|
||||
char parsubstr[32] WARN;
|
||||
|
||||
boost::shared_ptr<Object> parent WARN;
|
||||
Object* parent WARN;
|
||||
boost::shared_ptr<Object> track WARN;
|
||||
|
||||
boost::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
|
||||
@@ -490,7 +491,7 @@ struct Object : ElemBase {
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Base : ElemBase {
|
||||
boost::shared_ptr<Base> prev WARN;
|
||||
Base* prev WARN;
|
||||
boost::shared_ptr<Base> next WARN;
|
||||
boost::shared_ptr<Object> object WARN;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2012, assimp team
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -18,10 +18,10 @@ following conditions are met:
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
||||
Reference in New Issue
Block a user