Fix crash on exit or resume on iOS 13

Fixes #7966.

(cherry picked from commit 29bde8cd74)
This commit is contained in:
Max 2019-10-29 10:58:59 +03:00 committed by Rémi Verschelde
parent 2d386ec2fa
commit 82e52c32a6
1 changed files with 11 additions and 12 deletions

View File

@ -330,7 +330,6 @@ static void clear_touches() {
[self destroyFramebuffer]; [self destroyFramebuffer];
[self createFramebuffer]; [self createFramebuffer];
[self drawView]; [self drawView];
[self drawView];
} }
- (BOOL)createFramebuffer { - (BOOL)createFramebuffer {
@ -446,22 +445,22 @@ static void clear_touches() {
// Updates the OpenGL view when the timer fires // Updates the OpenGL view when the timer fires
- (void)drawView { - (void)drawView {
if (useCADisplayLink) {
// Pause the CADisplayLink to avoid recursion
[displayLink setPaused:YES];
// Process all input events
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource)
;
// We are good to go, resume the CADisplayLink
[displayLink setPaused:NO];
}
if (!active) { if (!active) {
printf("draw view not active!\n"); printf("draw view not active!\n");
return; return;
}; };
if (useCADisplayLink) {
// Pause the CADisplayLink to avoid recursion
[displayLink setPaused:YES];
// Process all input events
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, TRUE) == kCFRunLoopRunHandledSource)
;
// We are good to go, resume the CADisplayLink
[displayLink setPaused:NO];
}
// Make sure that you are drawing to the current context // Make sure that you are drawing to the current context
[EAGLContext setCurrentContext:context]; [EAGLContext setCurrentContext:context];