multiple <init_from> crashes static DOM

While implementing a cubemap initialization of the <surface> element loading each cube face by a single 2d-img, I came up with this xml-code:

 
<newparam sid="file8Surface">
  <surface type="CUBE">
    <init_from face="POSITIVE_X" slice="0" mip="0">envCubePosX</init_from>
    <init_from face="NEGATIVE_X"  slice="0" mip="0">envCubeNegX</init_from>
    <init_from face="POSITIVE_Y"  slice="0" mip="0">envCubePosY</init_from>
    <init_from face="NEGATIVE_Y"  slice="0" mip="0">envCubeNegY</init_from>
    <init_from face="POSITIVE_Z"  slice="0" mip="0">envCubePosZ</init_from>
    <init_from face="NEGATIVE_Z"  slice="0" mip="0">envCubeNegZ</init_from>
    
    <mipmap_generate>true</mipmap_generate>
  </surface>
</newparam>

According to the schema this should be valid (please correct if I’m wrong). However loading a document with those init_from arrays crashes the DOM, while loading the document.

I tried a small example loading the document only, with the following mini-code:

#include <dae.h>

int main(int argc, char* argv[]) {
	
	DAE* daeObject = new DAE;

	int error = daeObject->load("cubeInitBug.dae");

	return 0;
}

The DOM crashes in daeElement::release(). Strange enough, this happens with the statically linked version only, DLL-DOM seems to load without complaining.

You can try this dae file, the dead file references are not important for this problem:

cubeInitBug.tar.gz

I know, you could also load each face with

<init_cube>
  <face ref="...">
   ...
</init_cube>

(which works well loading a document)

But I understand init_cube should be used with compound images only (like DDS)…

I wasn’t sure if that’s really a bug, if it is, I will post it on sourceforge.

Looking into this bug just opened a whole big can of worms.

I don’t really know how long it will take to fix these issues uncovered. I am working on it now.

-Andy

Ok, this is fixed in the COLLADA DOM sourceforge subversion.

In the future please post bugs like this on the sourceforge bug tracker.

Thanks,
-Andy