summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceTextureClient.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-11-17 18:46:09 -0800
committer Mathias Agopian <mathias@google.com> 2011-11-17 18:46:09 -0800
commita36bcd53ac075054bb39ef506687f4daaf9bac6b (patch)
treece462990108fdb5d645661ffccad80d38311ff39 /libs/gui/SurfaceTextureClient.cpp
parentd858f059403f8bc2db74294c905933002af6388d (diff)
attempt to fix bug 5313580
the working theory here is that a Surface object has become non-promotable because it lost its last reference; later Surface::readFromParcel is called the previous surface is found in the cache, but can't be promoted. this causes a new Surface object to be created which will promptly try to connect to the CPU_API -- this in turn will fail because the previous (now dead) surface is still connected. To fix this, we make sure to disconnect from the SurfaceTexture when Surface[TextureClient] is destroyed. Change-Id: I422234868a05d7b7d283e9d5a85f7ab79e65d8a9
Diffstat (limited to 'libs/gui/SurfaceTextureClient.cpp')
-rw-r--r--libs/gui/SurfaceTextureClient.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 98fa17174e..48070d67c3 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -36,6 +36,12 @@ SurfaceTextureClient::SurfaceTextureClient() {
SurfaceTextureClient::init();
}
+SurfaceTextureClient::~SurfaceTextureClient() {
+ if (mConnectedToCpu) {
+ SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
+ }
+}
+
void SurfaceTextureClient::init() {
// Initialize the ANativeWindow function pointers.
ANativeWindow::setSwapInterval = hook_setSwapInterval;