I had a data loader send a message to its delegate when its done
- (void) loadingMethod {
// Loading stuff...
[delegate LoaderDidFinish];
}
The delegate then relases the loader that called it, then does some stuff.
- (void) LoaderDidFinish {
[Loader release];
// Do stuff
}
This caused a bad acces error.
I assuemed this was cause because after LoaderDidFinish
finished control returned to the loadingMethod
which had been released.
However what suppried me was the fact that releasing the Loader
later on in the method fixed the problem:
- (void) LoaderDidFinish {
// Do stuff
[Loader release]; // Now there is no bad access error!
}
Can someone explain why this worked?