views:

36

answers:

1

I've got some threads doing heavy work while my main thread handles the UI stuff. The threads callback to the main thread at times to update a progress bar.

All in all, it's not that stable. I've fixed problems relating to the logic, but one in particular persists. I've got some code that acts like a stop button, meaning that the thread won't try and renew itself the next time it comes around to check what's going on.

Sometimes, when I press the stop button, I receive this error:

-[NSRunLoop isEnabled]: unrecognized selector sent to instance...

It seems to happen if I hit the stop button towards the end of the thread's work phase. During this time, it doesn't do much except:

  • Release some OpenGL memory
  • Call a final method on the main thread
  • Drain its autorelease pool
  • And return

But frankly, the error message is too cryptic for me to even know where to begin. Can anyone shed some light on NSRunLoop, what this 'isEnabled' method might be, or a general stab at what might be going wrong?

+1  A: 

Try running with Zombies enabled. I wouldn't be surprised if one of the runloop objects from a thread is getting destroyed and overwritten by another object, but you've still got a stale pointer to where it used to be.

Dave DeLong
Ah, I've heard about this thing but never used it. I think this might solve many of my threadaches. Sorry. >_>
mtc06
You are a little star. I've got this - "*** -[UITapGestureRecognizer retain]: message sent to deallocated instance" So I'll go chase that up. Excellent tool.
mtc06