| Index: platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp
|
| 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 487835b31d14c4c6e57e49bf0903e7d147f7c780..a35742b2d084530ba3a2604f5cc07a91f3fac98a 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() {
|
|
|