bilwis / RMD

RMD
0 stars 0 forks source link

Refactor of the Body systems #15

Closed bilwis closed 9 years ago

bilwis commented 9 years ago

Previously, the Part-derived classes used a tree-like structure of raw pointers to their super parts, their children, their connected organs, etc. This was very much at risk for dangling pointer references and memory leaks.

The new system is based on two principles: a) The pointers to the Parts are now stored exclusively in the Body instance that serves as their organizer. b) Parts refer to each other only by a UUID (generated by the boost::uuids framework), which is resolved by the Body instance.

Fixing the parsing and removal functions to work with this new system was a total PITA, but there should be no more (or at least far less) dangling pointer crashes and hopefully no memory leaks.