diff options
author | joshualitt <joshualitt@chromium.org> | 2015-10-26 12:00:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-26 12:00:42 -0700 |
commit | 6db78d74fab9b285e7d4b4ae54ad278420596e8a (patch) | |
tree | 26822685179a683623f9abdcbdf57dee06536f51 | |
parent | 86ea33e96341ec3de03bcb6aef9a2cfce371df6a (diff) |
Fix visualbench exiting on startup on android
BUG=skia:
Review URL: https://codereview.chromium.org/1416123003
-rw-r--r-- | platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp index 487835b31d..a35742b2d0 100644 --- a/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp +++ b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp @@ -18,19 +18,7 @@ SkOSWindow::SkOSWindow(void* hwnd) { } SkOSWindow::~SkOSWindow() { - if (fWindow.fDisplay != EGL_NO_DISPLAY) { - eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (fWindow.fContext != EGL_NO_CONTEXT) { - eglDestroyContext(fWindow.fDisplay, fWindow.fContext); - } - if (fWindow.fSurface != EGL_NO_SURFACE) { - eglDestroySurface(fWindow.fDisplay, fWindow.fSurface); - } - eglTerminate(fWindow.fDisplay); - } - fWindow.fDisplay = EGL_NO_DISPLAY; - fWindow.fContext = EGL_NO_CONTEXT; - fWindow.fSurface = EGL_NO_SURFACE; + this->detach(); } bool SkOSWindow::attach(SkBackEndTypes attachType, @@ -147,7 +135,19 @@ bool SkOSWindow::attach(SkBackEndTypes attachType, } void SkOSWindow::detach() { - fDestroyRequested = true; + if (fWindow.fDisplay != EGL_NO_DISPLAY) { + eglMakeCurrent(fWindow.fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (fWindow.fContext != EGL_NO_CONTEXT) { + eglDestroyContext(fWindow.fDisplay, fWindow.fContext); + } + if (fWindow.fSurface != EGL_NO_SURFACE) { + eglDestroySurface(fWindow.fDisplay, fWindow.fSurface); + } + eglTerminate(fWindow.fDisplay); + } + fWindow.fDisplay = EGL_NO_DISPLAY; + fWindow.fContext = EGL_NO_CONTEXT; + fWindow.fSurface = EGL_NO_SURFACE; } void SkOSWindow::present() { |