Log in or register to post comments

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 16, 2015 - 7:23am #1

I've just updated to Vuforia 5.0.6 in my iOS app. I was running Vuforia 4 before, with no issues at all (except for the black screen in iOS9). 

Now, I'm having another issue (a new one): when I lock the screen, I can get one of these two EXC_BAD_ACCESS:

1. glFinish() -> within the finishOpenGLESCommands method

2. [self.context presentRenderbuffer:GL_RENDERBUFFER]; -> within the presentFramebuffer method

 

Just for the record, the app and the lines mentioned before where working perfect before updating to Vuforia 5.0.6. 

 

Any idea of what might be happening here? Did the latest update change something else not documented in the migration guide?

 

Thanks,

Federico

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

August 30, 2017 - 2:29pm #12

At what point in running the app are you getting this crash?

Thanks,

-Vuforia Support

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

August 30, 2017 - 6:02am #11

Hello I am also facing this issue in playback demo but I couldn't find class names which you have written in Vuforia Demo app. 

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 20, 2015 - 9:35am #10

Sure, here's the fix:

 

CustomARViewController.mm:
 
- (void) viewDidAppear: (BOOL) animated
{
    [super viewDidAppear: animated];
 
    // Custom code...
 
    [self.arView updateRenderStatus:YES];
}
 
- (void) viewDidDisappear: (BOOL) animated
{
    [super viewDidDisappear: animated];
 
    // Custom code...
 
    [self.arView updateRenderStatus:NO];
}
 
 
CustomEAGLView.mm:
 
@interface CustomEAGLView() {
    BOOL readyToRender;
}
 
- (id) initWithFrame: (CGRect) frame 
{
    self = [super initWithFrame: frame];
    if (self) {
        // Custom init code...
        readyToRender = NO;
    }
    return self;
}
 
- (void) updateRenderStatus: (BOOL) ready
{
    @synchronized(self) {
        readyToRender = ready;
    }
}
 
- (void) renderFrameQCAR
{
    [self setFramebuffer];
    
    // Custom code...
    
    @synchronized(self) {
        if (readyToRender) {
            [self presentFramebuffer];
        }
    }
}
 
 
Thanks again

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 20, 2015 - 7:16am #9

BTW, we also tested on 9.0 and 9.0.2, but we could not reproduce the crash; so, this seems probably a timing / threading issue (as you also noted),  that shows up a bit "randomly", but not consistently / not all the time..

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 20, 2015 - 6:54am #8

Nice. Could you post the relevant code snippets of your solution here ?

 

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 19, 2015 - 12:55pm #7

Well, I think I've got it working.. (really still don't know why this didn't happend with Vuforia 4). The issue was that once I pressed the lock button, "sometimes" it crashed in presentFramebuffer. My assumption was based on this stackoverflow issue: http://stackoverflow.com/questions/19379541/mysterious-app-crash-with-opengl/19387119#19387119. 

I believe it should be a timing issue between:

1. Vuforia calling renderFrameQCAR

2. App resigning active

3. Work being done inside renderFrameQCAR, between setFramebuffer and presentFramebuffer

 

The fix (based on the stackoverflow link shared before) was:

1. In the view controller: update a flag (synchronized) inside the EAGLView, every time the app goes to background and comes back

2. Inside the EAGLView's method renderFrameQCAR, make sure I check the value of that flag, synchronizing the same resource

 

This way, presentFramebuffer will always be called with the app in foreground.

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 19, 2015 - 7:16am #6

Could you also make a test on iOS 9.0.2 on your side and confirm (or not) whether you get the same result that we observe here ?

 

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 19, 2015 - 6:17am #5

I've downloaded the Vuforia Samples for 5.0.5, and updated the library with the iOS 5.0.6 version. Same bug: I've tested in iPhone 5 and iPad running iOS 9.0 (not 9.0.2), and it's crashing when I'm coming back from the lock screen: this is the line again: return [context presentRenderbuffer:GL_RENDERBUFFER];

Maybe it's something related to iOS 9.0, I don't know, but it would be great to know and, if possible, to make it work there as well (not every user of my app has 9.0.2 installed yet).

 

Thanks

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 18, 2015 - 11:55pm #4

Have you tried the Vuforia Samples ?

Tested a screen lock/unlock sequence with a few consecutive locks and unlocks on 2 different iOS 9.0.2 devices (iPhone 5S and iPad mini), but I could not reproduce the crash in the presentFrameBuffer.

 

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 16, 2015 - 8:00am #3

Hi AlessandroB, thanks for your quick response.

 

I've tried that, and this is what happen:

1. Open the app: everything looks perfect

2. Lock screen: all good now (there was a crash here before commenting the line finishOpenGLESCommands within applicationWillResignActive)

3. Unlock the device: app working as expected again

4. Lock the screen again: CRASH -> [self.context presentRenderbuffer:GL_RENDERBUFFER], within presentFramebuffer

 

Any further idea??

 

Thanks,

Federico

Vuforia 5.0.6 + iOS9 + OpenGL calls -> BAD ACCESS

October 16, 2015 - 7:40am #2

Have you already tried the fix discussed in this thread :

https://developer.vuforia.com/forum/issues-and-bugs/crash-after-lock-unlock-device-screen

?

Log in or register to post comments