I have the same problem that TheLutariFan exposed in a similar thread. The difference is that in my case I have a class instance defined and initialized whose contents is read from a file when I press a button in my interface window.
The first time that I press the button and I read the file, everything works ok: before the read operation I look at the class instance with the help of the debugger, and the instance is there with 0 objects inside (the class is a NSMutableArray of other objects). After reading from the file, the instance of the class is still there with 3 objects read from the file. Everything is fine. Then the method associated with the read button action function ends.
The next time that I press the read button, when I enter the read button action function, the class has no longer the 3 objects that where left the last time, in fact the debugger does not tell that it has any object (no 0 object message appears when looking at the class instance).
I don't know what has happened before the previous exit of the button function and the current entering, but my class instance contents has disappeared and the class does not show any longer any object inside. Afterwards, the EXC_BAD_ACCESS message appears.
I know that is quite a weird thing to explain in plain text with no code, but the facts are as I have described.
What may happen between the 2 button function calls that destroys, or deallocates my class ? What does it mean when I look at my class and no "n object" message appears ?
Is there the possibility in the debugger to place watchpoints in variables or memory locations so that when some part of the code modifies these locations or variables, the debugger stops and then we can see what part of the code has modified them ?
There are 4 days that I'm stuck here, and I don't know what to do. Any hint would be very much appreciated.
Thanks and best regards
Joan
The first time that I press the button and I read the file, everything works ok: before the read operation I look at the class instance with the help of the debugger, and the instance is there with 0 objects inside (the class is a NSMutableArray of other objects). After reading from the file, the instance of the class is still there with 3 objects read from the file. Everything is fine. Then the method associated with the read button action function ends.
The next time that I press the read button, when I enter the read button action function, the class has no longer the 3 objects that where left the last time, in fact the debugger does not tell that it has any object (no 0 object message appears when looking at the class instance).
I don't know what has happened before the previous exit of the button function and the current entering, but my class instance contents has disappeared and the class does not show any longer any object inside. Afterwards, the EXC_BAD_ACCESS message appears.
I know that is quite a weird thing to explain in plain text with no code, but the facts are as I have described.
What may happen between the 2 button function calls that destroys, or deallocates my class ? What does it mean when I look at my class and no "n object" message appears ?
Is there the possibility in the debugger to place watchpoints in variables or memory locations so that when some part of the code modifies these locations or variables, the debugger stops and then we can see what part of the code has modified them ?
There are 4 days that I'm stuck here, and I don't know what to do. Any hint would be very much appreciated.
Thanks and best regards
Joan