Nil out EAGLContext explicitly on RTCEAGLVideoView dealloc.
Theoretical fix to address some EAGLContext issues from other UIImageViews that could be active.
NOTRY=True
BUG=
Review-Url: https://codereview.webrtc.org/2259513002
Cr-Commit-Position: refs/heads/master@{#13806}
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m b/webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m
index 01c839a..d39c598 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m
+++ b/webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m
@@ -93,6 +93,7 @@
@implementation RTCEAGLVideoView {
RTCDisplayLinkTimer *_timer;
+ EAGLContext *_glContext;
// This flag should only be set and read on the main thread (e.g. by
// setNeedsDisplay)
BOOL _isDirty;
@@ -123,11 +124,12 @@
if (!glContext) {
glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
- _glRenderer = [[RTCOpenGLVideoRenderer alloc] initWithContext:glContext];
+ _glContext = glContext;
+ _glRenderer = [[RTCOpenGLVideoRenderer alloc] initWithContext:_glContext];
// GLKView manages a framebuffer for us.
_glkView = [[GLKView alloc] initWithFrame:CGRectZero
- context:glContext];
+ context:_glContext];
_glkView.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
_glkView.drawableDepthFormat = GLKViewDrawableDepthFormatNone;
_glkView.drawableStencilFormat = GLKViewDrawableStencilFormatNone;
@@ -169,6 +171,9 @@
[self teardownGL];
}
[_timer invalidate];
+ if (_glContext && [EAGLContext currentContext] == _glContext) {
+ [EAGLContext setCurrentContext:nil];
+ }
}
#pragma mark - UIView