| Index: ui/gl/gl_image_shm.cc
|
| diff --git a/ui/gl/gl_image_shm.cc b/ui/gl/gl_image_shm.cc
|
| index 75ef453eade794fe846ed1548dbe90d7e56f6f3f..b910487eca13fa1b40ae96cd4861ef1b3c96749b 100644
|
| --- a/ui/gl/gl_image_shm.cc
|
| +++ b/ui/gl/gl_image_shm.cc
|
| @@ -79,7 +79,14 @@ GLImageShm::GLImageShm(gfx::Size size, unsigned internalformat)
|
| {
|
| }
|
|
|
| -GLImageShm::~GLImageShm() { Destroy(); }
|
| +GLImageShm::~GLImageShm() {
|
| + DCHECK(!shared_memory_);
|
| +#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
|
| + defined(USE_OZONE)
|
| + DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
|
| + DCHECK_EQ(0u, egl_texture_id_);
|
| +#endif
|
| +}
|
|
|
| bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) {
|
| if (!ValidFormat(internalformat_)) {
|
| @@ -105,7 +112,8 @@ bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) {
|
| return true;
|
| }
|
|
|
| -void GLImageShm::Destroy() {
|
| +void GLImageShm::Destroy(bool have_context) {
|
| + shared_memory_.reset();
|
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
|
| defined(USE_OZONE)
|
| if (egl_image_ != EGL_NO_IMAGE_KHR) {
|
| @@ -114,7 +122,8 @@ void GLImageShm::Destroy() {
|
| }
|
|
|
| if (egl_texture_id_) {
|
| - glDeleteTextures(1, &egl_texture_id_);
|
| + if (have_context)
|
| + glDeleteTextures(1, &egl_texture_id_);
|
| egl_texture_id_ = 0u;
|
| }
|
| #endif
|
|
|