ios - Cancelled NSOperation EXC_BAD_ACCESS crash when setting isFinished -


i have nsoperation subclass runs async operations uitableview.

i override correct start , finish methods this:

- (void)start {     [self willchangevalueforkey:@"isexecuting"];     self.isexecuting = yes;     [self didchangevalueforkey:@"isexecuting"];      if (self.iscancelled)     {         [self finish];         return;     } } - (void)finish {        if (!_isexecuting)         {             [self willchangevalueforkey:@"isexecuting"];             _isexecuting = yes;             [self didchangevalueforkey:@"isexecuting"];         }          [self willchangevalueforkey:@"isexecuting"];         [self willchangevalueforkey:@"isfinished"];          _isexecuting = no;         _isfinished = yes;          [self didchangevalueforkey:@"isexecuting"];         [self didchangevalueforkey:@"isfinished"]; } 

the problem have, if scroll down table , delete row, calls cancel method on operation, operations gradually complete , reaches further down table, crashes exc_bad_access error on line [self didchangevalueforkey:@"isfinished"];

the code pretty complex paste here, i'd know how can track down object causing kvo message crash?

if enable zombie objects in debugger, doesn't crash @ no warnings doesn't help.

if wrap kvo methods in try/catch never caught , still crashes.

i have tried overriding kvo methods in nsoperation subclass, never called:

- (void)addobserver:(nsobject *)observer forkeypath:(nsstring *)keypath options:(nskeyvalueobservingoptions)options context:(void *)context {     nslog(@"%s - %@", __pretty_function__, observer);     [super addobserver:observer forkeypath:keypath options:options context:context]; } 

is possible see observers are?

comments , ideas:

  1. in start shouldn't self.isexecuting = yes _isexecuting = yes;?
  2. add property called identifierof type nsstring, , set each op.
  3. add dealloc method , log identifier.
  4. in finish test iscancelled , return if so.

another thought doubly retain operations - put them in nsdictionary identifier key, , see if changes.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -