@samuel-larsson wrote:
Hi,
I need two ofNode vector, where every ofNode in one vector is a parent to one ofNode in the other.
ofNode node = ofNode(); nodes.push_back(node); ofNode childNode = ofNode(); childNodes.push_back(childNode); childNodes.back().setParent(nodes.back());This works fine for the first pair, but when the second node gets pushed (the second time row 2 is run), the destructor for the first node is called, which means that the child-parent pointers are dereferenced, leading to null pointers further down in the code.
How do I work around this?
Thanks,
Samuel
Posts: 4
Participants: 2