Hey guys

I have a piece of code that runs in a background thread, and it crashes randomly. I can't see any structure to the crashing, other than it always seem to crash at the following line:

jpeg_data = rep.representationUsingType NSJPEGFileType, properties:options

Are there any known issues with this and macruby, or am I wrong somewhere else? I tried running it both on the main thread and also by using sync instead of async when i dispatch the thread to the queue, but it still crashes randomly.

I'm not entierly sure how to debug this, all I get in the log is an EXC_BAD_ACCESS and then it stops in my editor at objc_msgSend.
Any ideas? :)

PS. I need to rescale an image, if anyone know any other way that works in a background thread please share. :)

Thanks!
Kenny