0

I am using a TabBarController with two tabs. In the second I am calling an NSOperation, adding the operation to an NSOperationQueue. When I select the second tab, I have called this operation on the main thread. But when I switch to the first tab the app crashes. I am properly releasing and cancelling the operation

I get the following message for bt

#0  0x0243d09b in objc_msgSend ()
#1  0x1299c4a0 in ?? ()
#2  0x008b6d23 in -[__NSOperationInternal start] ()
#3  0x008b6a34 in -[NSOperation start] ()
#4  0x00943301 in __block_global_6 ()
#5  0x0222753f in _dispatch_call_block_and_release ()
#6  0x02239014 in _dispatch_client_callout ()
#7  0x0222a2e8 in _dispatch_root_queue_drain ()
#8  0x02229fcb in _dispatch_worker_thread3 ()
#9  0x99a16b24 in _pthread_wqthread ()
#10 0x99a186fe in start_wqthread ()

Please suggest any solution

Manuel
  • 10,153
  • 5
  • 41
  • 60
Nassif
  • 1,113
  • 2
  • 14
  • 34

1 Answers1

0

Make sure to determine the ownership of the NSOperationQueue. Also, make sure that all instances which are needed by the NSOperation are not released while switching the tabs.

Could you please show the stacktraces of the threads which are doing the actual work?

ff10
  • 3,046
  • 1
  • 32
  • 55
  • It was my mistake,instead of cancelling the operation in viewwillDisappear i did in the viewDidDisappear. – Nassif Jan 16 '13 at 10:31