summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl_object.h
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-08-24 14:54:56 -0700
committerJamie Gennis <jgennis@google.com>2011-08-24 15:00:23 -0700
commit9f24fd020e387d57cb05d58f26985baa44571b85 (patch)
treebb6ca3f773476a6f6c2785891b3e4f03c34fcaba /opengl/libs/EGL/egl_object.h
parentc2d9862c859eb61afccf93ba2824136b6bb7a987 (diff)
downloadframeworks_native-9f24fd020e387d57cb05d58f26985baa44571b85.zip
frameworks_native-9f24fd020e387d57cb05d58f26985baa44571b85.tar.gz
frameworks_native-9f24fd020e387d57cb05d58f26985baa44571b85.tar.bz2
EGL: move disconnect to surface dtor
This change moves the call to native_window_api_disconnect from eglDestroySurface to the egl_surface_t destructor. The egl_surface_t can outlive the external EGLSurface if eglDestroySurface is called while the surface is made current on a thread. Change-Id: I0df6117a5633c2a19935fe356579abdd76fc471f
Diffstat (limited to 'opengl/libs/EGL/egl_object.h')
-rw-r--r--opengl/libs/EGL/egl_object.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 3459a8a..d2b7378 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -125,7 +125,15 @@ void egl_object_t::LocalRef<N,T>::terminate() {
class egl_surface_t: public egl_object_t {
protected:
- ~egl_surface_t() {}
+ ~egl_surface_t() {
+ ANativeWindow* const window = win.get();
+ if (window != NULL) {
+ native_window_set_buffers_format(window, 0);
+ if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
+ LOGE("EGLNativeWindowType %p disconnected failed", window);
+ }
+ }
+ }
public:
typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
@@ -232,4 +240,3 @@ egl_sync_t* get_sync(EGLSyncKHR sync) {
// ----------------------------------------------------------------------------
#endif // ANDROID_EGL_OBJECT_H
-