tell our grcontext to abandon its backend

BUG=skia:

Review URL: https://codereview.chromium.org/692803003
This commit is contained in:
reed 2014-10-30 11:29:08 -07:00 committed by Commit bot
parent 902d4d18de
commit 789e327ad9
2 changed files with 7 additions and 2 deletions

View File

@ -259,8 +259,12 @@ public:
virtual void tearDownBackend(SampleWindow *win) { virtual void tearDownBackend(SampleWindow *win) {
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
SkSafeUnref(fCurContext); if (fCurContext) {
// in case we have outstanding refs to this guy (lua?)
fCurContext->abandonContext();
fCurContext->unref();
fCurContext = NULL; fCurContext = NULL;
}
SkSafeUnref(fCurIntf); SkSafeUnref(fCurIntf);
fCurIntf = NULL; fCurIntf = NULL;

View File

@ -386,6 +386,7 @@ CGLContextObj createGLContext(int msaaSampleCount) {
andGetInfo:(SkOSWindow::AttachmentInfo*) info { andGetInfo:(SkOSWindow::AttachmentInfo*) info {
if (nil == fGLContext) { if (nil == fGLContext) {
CGLContextObj ctx = createGLContext(sampleCount); CGLContextObj ctx = createGLContext(sampleCount);
SkASSERT(ctx);
fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx]; fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx];
CGLReleaseContext(ctx); CGLReleaseContext(ctx);
if (NULL == fGLContext) { if (NULL == fGLContext) {