FBX: fix memory leak. Connection objects in Document never freed. See #307
parent
cd88ea745d
commit
5ae010028b
|
@ -253,8 +253,8 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
|
|||
: settings(settings)
|
||||
, parser(parser)
|
||||
{
|
||||
// cannot use array default initialization syntax because vc8 fails on it
|
||||
for (unsigned int i = 0; i < 7; ++i) {
|
||||
// Cannot use array default initialization syntax because vc8 fails on it
|
||||
for (unsigned int i = 0; i < sizeof(creationTimeStamp) / sizeof(creationTimeStamp[0]); ++i) {
|
||||
creationTimeStamp[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
|
|||
|
||||
ReadGlobalSettings();
|
||||
|
||||
// this order is important, connections need parsed objects to check
|
||||
// This order is important, connections need parsed objects to check
|
||||
// whether connections are ok or not. Objects may not be evaluated yet,
|
||||
// though, since this may require valid connections.
|
||||
ReadObjects();
|
||||
|
@ -277,13 +277,18 @@ Document::~Document()
|
|||
BOOST_FOREACH(ObjectMap::value_type& v, objects) {
|
||||
delete v.second;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(ConnectionMap::value_type& v, src_connections) {
|
||||
delete v.second;
|
||||
}
|
||||
// |dest_connections| contain the same Connection objects as the |src_connections|
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Document::ReadHeader()
|
||||
{
|
||||
// read ID objects from "Objects" section
|
||||
// Read ID objects from "Objects" section
|
||||
const Scope& sc = parser.GetRootScope();
|
||||
const Element* const ehead = sc["FBXHeaderExtension"];
|
||||
if(!ehead || !ehead->Compound()) {
|
||||
|
@ -293,7 +298,7 @@ void Document::ReadHeader()
|
|||
const Scope& shead = *ehead->Compound();
|
||||
fbxVersion = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(shead,"FBXVersion",ehead),0));
|
||||
|
||||
// while we maye have some success with newer files, we don't support
|
||||
// While we maye have some success with newer files, we don't support
|
||||
// the older 6.n fbx format
|
||||
if(fbxVersion < 7100) {
|
||||
DOMError("unsupported, old format version, supported are only FBX 2011, FBX 2012 and FBX 2013");
|
||||
|
|
Loading…
Reference in New Issue