Getting the globalPosition of a parent node is crashing the app

Hello, I’m trying to get the gloabl position of a parent node, but the app crashes with the error: Thread 1: EXC_BAD_ACCESS

To reproduce the error, is enough to put this code in the setup method:


    auto bla = ofNode();
    bla.boom(200);
    auto blu = ofNode(bla);
    blu.getGlobalPosition();
    blu.getParent()->getGlobalPosition();

Does anyone has experienced something similar? is this the proper way to get the global position of a parent node without accessing it directly?

you are not setting the parent so getParent() will return nullptr and will crash if you try to dereference it or access any of it’s methods

it works thanks

I thought that passing a node to the constructor like this

was like to setting the parent.

ah, no i didn’t saw that before, that just makes a copy of the original