CCPointFromString is crashing.

CCPointFromString is crashing.
0.0 0


I am doing a CCPointFromString conversion but my coding crashing whenever I am trying to take input, Here is the code , what I am doing wrong?

CCPoint *temp = new CCPoint(oldLocationCon.x, oldLocationCon.y);
for; i++){
CCString *point = pointInsert~~>objectAtIndex(i);
CCPoint savePoint= CCPointFromString(point->getCString());



Assuming pointInsert is a CCArray you could do this:

CCPoint* temp = new CCPoint(oldLocationCon.x, oldLocationCon.y);
temp~~>release(); // Fix memory leak, I explain later

for(int i=0; icount(); i++){
CCPoint* point = (CCPoint*) pointInsert~~>objectAtIndex;
Notice that you insert a CCPoint* object to the array and you must get a CCPoint* out of it later.
There’s no need to convert anything to string and back to point.
Besides that, you do a new of CCPoint, but nobody is doing a delete of it. If you take advantage of the framework’s reference counting you can avoid doing a delete yourself.
When you call array~~>addObject(temp) the array is calling temp~~>retain, so you can call temp~~>release() after it. When the element is removed from the array, this will call release for you and the object will be deleted.


@Xavier Arias, Thanks for the reply. Your answer works like a charm.