|
ofxObjCPointer
Any object you want this functionality, should extend ofxObjCPointer If someone passes you a pointer and you only need the data temporarily (you do not need the data beyond the scope of the function) just use the pointer/data and do not call any of the special methods (retain or release).
If you do need to keep the data beyond the scope of the function, call myObjPointer->retain() on the pointer to indicate that you need the data, and call myObjPointer->release() when you are done with it. If you allocated the pointer with new MyObject or retained it with myObj->retain() then you must always release it myObj->release() when you are done. You do not need to worry about whether anyone else is using the data or not, the reference count will take care of that. Never use delete myObj, only use myObj->release(); |
► Sign in to add a comment