diff options
author | Mathias Agopian <mathias@google.com> | 2009-10-06 19:00:57 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-10-06 19:00:57 -0700 |
commit | 9ec430adaea1cb88eaa1e78c7f759cd42ab6cf7a (patch) | |
tree | 1174b71aeaf88287d38538f8b7baa74532f6f638 /libs/ui | |
parent | ef8646344a7168643b50a51ebffa2e41e9717608 (diff) | |
download | frameworks_native-9ec430adaea1cb88eaa1e78c7f759cd42ab6cf7a.zip frameworks_native-9ec430adaea1cb88eaa1e78c7f759cd42ab6cf7a.tar.gz frameworks_native-9ec430adaea1cb88eaa1e78c7f759cd42ab6cf7a.tar.bz2 |
fix [2152536] ANR in browser
A window is created and the browser is about to render into it the
very first time, at that point it does an IPC to SF to request a new
buffer. Meanwhile, the window manager removes that window from the
list and the shared memory block it uses is marked as invalid.
However, at that point, another window is created and is given the
same index (that just go freed), but a different identity and resets
the "invalid" bit in the shared block. When we go back to the buffer
allocation code, we're stuck because the surface we're allocating for
is gone and we don't detect it's invalid because the invalid bit has
been reset.
It is not sufficient to check for the invalid bit, I should
also check that identities match.
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/SharedBufferStack.cpp | 10 | ||||
-rw-r--r-- | libs/ui/Surface.cpp | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libs/ui/SharedBufferStack.cpp b/libs/ui/SharedBufferStack.cpp index 47c596c..b460757 100644 --- a/libs/ui/SharedBufferStack.cpp +++ b/libs/ui/SharedBufferStack.cpp @@ -97,10 +97,10 @@ Region SharedBufferStack::getDirtyRegion(int buffer) const // ---------------------------------------------------------------------------- SharedBufferBase::SharedBufferBase(SharedClient* sharedClient, - int surface, int num) + int surface, int num, int32_t identity) : mSharedClient(sharedClient), mSharedStack(sharedClient->surfaces + surface), - mNumBuffers(num) + mNumBuffers(num), mIdentity(identity) { } @@ -248,8 +248,8 @@ ssize_t SharedBufferServer::StatusUpdate::operator()() { // ============================================================================ SharedBufferClient::SharedBufferClient(SharedClient* sharedClient, - int surface, int num) - : SharedBufferBase(sharedClient, surface, num), tail(0) + int surface, int num, int32_t identity) + : SharedBufferBase(sharedClient, surface, num, identity), tail(0) { tail = computeTail(); } @@ -353,7 +353,7 @@ status_t SharedBufferClient::setDirtyRegion(int buffer, const Region& reg) SharedBufferServer::SharedBufferServer(SharedClient* sharedClient, int surface, int num, int32_t identity) - : SharedBufferBase(sharedClient, surface, num) + : SharedBufferBase(sharedClient, surface, num, identity) { mSharedStack->init(identity); mSharedStack->head = num-1; diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index 7822533..2d83a8c 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -314,7 +314,7 @@ Surface::Surface(const sp<SurfaceControl>& surface) mWidth(surface->mWidth), mHeight(surface->mHeight) { mSharedBufferClient = new SharedBufferClient( - mClient->mControl, mToken, 2); + mClient->mControl, mToken, 2, mIdentity); init(); } @@ -336,7 +336,7 @@ Surface::Surface(const Parcel& parcel) mClient = SurfaceComposerClient::clientForConnection(clientBinder); mSharedBufferClient = new SharedBufferClient( - mClient->mControl, mToken, 2); + mClient->mControl, mToken, 2, mIdentity); } init(); |