[go: nahoru, domu]

Workaround to prevent crashes when destroying CGL contexts

Observation 1: It was discovered in crbug.com/410402 that deleting
the GL textures bound to IOSurfaces before releasing the CGL context
from the CAOpenGLLayer can result in crashes.

Observation 2: It was discovered in crbug.com/411782 that not deleting
the GL textures bounds to IOSurfaces before destroying the CGL context
can result in crashes.

As way speculative workaround for this, retain the CGL context when the
texture is created (when it is known to be valid), and the post a task to
- make that CGL context current
- delete the GL texture
- make no CGL context current
- release the CGL context
- release the IOSurface used by the GL texture

The theory here is that by doing this in a posted task, having a fresh stack
and having manually retained the CGL context when it was known-valid
will work around the crash in Observation 1, and manually destroying the
texture while its IOSurface is still retained and before the CGL context is
destroyed will work around the crash in Observation 2.

BUG=411782

Review URL: https://codereview.chromium.org/558803002

Cr-Commit-Position: refs/heads/master@{#294275}
2 files changed