As the code in question is auto generated by my cross-compiler I can assure that the pointer from such a function does always go into a ReferenceCountedObjectPtr<Thing> at the other end - all my class instances are references and local variables are always ReferenceCountedObjectPtr<Thing> too. So i should be ok in that situation shouldnt i ?
so for example with
Thing* getThing() {
ReferenceCountedObjectPtr<Thing> t = new Thing();
...
return t;
}
..not sure you fully understood what I meant in my previous post?
It rarely matters what happens to the pointer that is returned - there's not much damage you can do with that. The danger is that in the code-snippet I posted, it deletes the object inside the function, and then returns a dangling pointer.