Chromium Code Reviews| 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..68cd82c131d1ba748228060b1dc0277fb66b0de8 100644 |
| --- a/ui/gl/gl_image_shm.cc |
| +++ b/ui/gl/gl_image_shm.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/debug/trace_event.h" |
| #include "base/process/process_handle.h" |
| +#include "ui/gl/gl_context.h" |
|
reveman
2014/05/29 16:30:34
do we need this?
|
| #include "ui/gl/scoped_binders.h" |
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| @@ -79,7 +80,8 @@ GLImageShm::GLImageShm(gfx::Size size, unsigned internalformat) |
| { |
| } |
| -GLImageShm::~GLImageShm() { Destroy(); } |
| +GLImageShm::~GLImageShm() { |
|
reveman
2014/05/29 16:30:34
Verify that Destroy has been called.
|
| +} |
| bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| if (!ValidFormat(internalformat_)) { |
| @@ -105,7 +107,7 @@ bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| return true; |
| } |
| -void GLImageShm::Destroy() { |
| +void GLImageShm::Destroy(bool have_context) { |
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| defined(USE_OZONE) |
| if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| @@ -113,7 +115,7 @@ void GLImageShm::Destroy() { |
| egl_image_ = EGL_NO_IMAGE_KHR; |
| } |
| - if (egl_texture_id_) { |
| + if (egl_texture_id_ && have_context) { |
|
reveman
2014/05/29 16:30:34
I think you should set egl_texture_id_ to 0 even i
|
| glDeleteTextures(1, &egl_texture_id_); |
| egl_texture_id_ = 0u; |
| } |