bilwis / RMD

RMD
0 stars 0 forks source link

Adding more than four toes creates an error during graph compiling #1

Closed bilwis closed 10 years ago

bilwis commented 10 years ago

If the sum of the toes on both feet in the Body.XML is larger than eight, the program will crash during the subgraph creation phase of the BodyMap graph compiling. There does not appear to be a problem with parsing the XML itself and the internal representation of the body seems to be intact. There might be a problem with the ofstream handling or the recursive createSubgraphs function itself.

bilwis commented 10 years ago

Fixed with commit a7aacf2dc50459ad7a8ff0b92f777d86c3d05d62. Instead of copying the strings (id, name, etc.) parsed from the XML file, I copied pointers to them into the newly created Parts. When the rapidxml buffer was flushed, they pointed to unallocated memory resulting in errors in anything that was called on the Parts outside the initial parsing functions (which is why I didn't catch it with the debug output within the parsing function).

I always joked about someday having to use malloc(), now it's finally happened. I'm kinda expecting massive problems down the line with this (memory leaks and all that good jazz), but for now it works...