Question

I have an app which has been working fine on previous iterations of the iPad, but crashes on the new iPad Air.

The crash is happening at this line with the error EXE_BAD_ACCESS :

self.textureInfo = [GLKTextureLoader textureWithContentsOfData:imageData options:options error:&error];     
if (self.textureInfo == nil) {
    NSLog(@"Error loading texture file %@", [error localizedDescription]);
    return nil;
}

I am trying to troubleshoot this problem. Can anyone suggest why this might be a problem on the air, while exactly the same code works on all other devices ? This code is running on a thread.

Was it helpful?

Solution

To close this out, I'll restate what I did in my comment above:

Generally, when I've encountered odd OpenGL ES crashes like this that suddenly appear on one class of device or another, I always check for simultaneous accesses to the same OpenGL ES context. If you access a given OpenGL ES context from multiple threads at the same time, bad things will happen, including crashes like this.

My preferred way of handling this is to wrap accesses to a given OpenGL ES context in blocks on a GCD serial dispatch queue. That guarantees safe access to the context without the overhead of locks. It's also pretty easy to implement in your code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top