I clicked equals, and it runs all the code and reaches the end at clear, runs that and gets to the end and NSLogs it. At this point it has nothing more to do.... expect give me an error message for no reason, any idea why? Thanks!
-(IBAction) clickEquals: (id) sender {
// more stuff is actually insider here, omitted for brevity.
[self clear];
}
- (void)clear {
// more stuff is actually insider here, omitted for brevity.
[accumulator clear];
NSLog(@"clear - done");
}
Console
2010-12-29 15:24:38.328 app[6150:207] clear - done
开发者_运维知识库app(6150,0xa01e7540) malloc: * * * error for object 0x7146840: pointer being freed was not allocated * * * set a breakpoint in malloc_error_break to debug
(gdb)
app(6150,0xa01e7540) malloc: * * * error for object 0x7146840: pointer being freed was not allocated * * * set a breakpoint in malloc_error_break to debug
Your program has caused something to be freed that was never allocated. More likely than not, it is because a garbage pointer was passed to free()
, maybe because you forgot to initialize something or maybe because your app is trashing memory.
In any case, follow the instructions and set a breakpoint on malloc_error_break
and post the backtrace.
More likely than not, the cause is in the // more stuff is actually insider here, omitted for brevity. bits or in the [accumulator clear]
method.
精彩评论