Re: QtSphere IDE 0.2.5
Reply #109 –
The way the system is described, it seems you’re meant to pass around the shared object itself, rather than a pointer to it. This ends up being efficient because the object is merely a wrapped pointer so there’s no significant cost in making copies of it.
What I’m guessing is that you’re creating the object on the stack and then returning a pointer to it. This leaves you with a dangling pointer because the object itself goes out of scope. A pointer doesn’t count as a live reference, it’s just a dumb memory address.
CSomeClass object(arg1, arg2);
return &object; // dangling ptr, ticking time bomb