| Index: ui/gl/gl_image_memory.cc
|
| diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
|
| index 5d0f901c812fde7d71819ac47306cbbb75994256..5748b89452f1ebbc5f404124349a87e017c5ccde 100644
|
| --- a/ui/gl/gl_image_memory.cc
|
| +++ b/ui/gl/gl_image_memory.cc
|
| @@ -81,6 +81,11 @@ GLImageMemory::GLImageMemory(const gfx::Size& size, unsigned internalformat)
|
| }
|
|
|
| GLImageMemory::~GLImageMemory() {
|
| +#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 GLImageMemory::Initialize(const unsigned char* memory) {
|
| @@ -95,7 +100,7 @@ bool GLImageMemory::Initialize(const unsigned char* memory) {
|
| return true;
|
| }
|
|
|
| -void GLImageMemory::Destroy() {
|
| +void GLImageMemory::Destroy(bool have_context) {
|
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
|
| defined(USE_OZONE)
|
| if (egl_image_ != EGL_NO_IMAGE_KHR) {
|
| @@ -104,7 +109,8 @@ void GLImageMemory::Destroy() {
|
| }
|
|
|
| if (egl_texture_id_) {
|
| - glDeleteTextures(1, &egl_texture_id_);
|
| + if (have_context)
|
| + glDeleteTextures(1, &egl_texture_id_);
|
| egl_texture_id_ = 0u;
|
| }
|
| #endif
|
|
|