diff options
| author | Mathias Agopian <mathias@google.com> | 2011-02-16 15:43:17 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-16 15:43:17 -0800 |
| commit | 260a13a95edbe41fb8042b96b8c35a8a65546ec0 (patch) | |
| tree | 8cbb62974134ccab6bf101832ee5515cd5b6fb1c /services/surfaceflinger/LayerBase.cpp | |
| parent | b5fd7ae4ce28af9217fbd80716466f971bb96d69 (diff) | |
| parent | 1b0114f5db78c46b1f4c6a83e6d219bbe1e838e4 (diff) | |
| download | frameworks_base-260a13a95edbe41fb8042b96b8c35a8a65546ec0.zip frameworks_base-260a13a95edbe41fb8042b96b8c35a8a65546ec0.tar.gz frameworks_base-260a13a95edbe41fb8042b96b8c35a8a65546ec0.tar.bz2 | |
Merge "fix a surface leak in SurfaceFlinger"
Diffstat (limited to 'services/surfaceflinger/LayerBase.cpp')
| -rw-r--r-- | services/surfaceflinger/LayerBase.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index 86057f8..6025ed4 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -540,7 +540,9 @@ int32_t LayerBaseClient::sIdentity = 1; LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, const sp<Client>& client) - : LayerBase(flinger, display), mClientRef(client), + : LayerBase(flinger, display), + mHasSurface(false), + mClientRef(client), mIdentity(uint32_t(android_atomic_inc(&sIdentity))) { } @@ -557,12 +559,13 @@ sp<LayerBaseClient::Surface> LayerBaseClient::getSurface() { sp<Surface> s; Mutex::Autolock _l(mLock); - s = mClientSurface.promote(); - if (s == 0) { - s = createSurface(); - mClientSurface = s; - mClientSurfaceBinder = s->asBinder(); - } + + LOG_ALWAYS_FATAL_IF(mHasSurface, + "LayerBaseClient::getSurface() has already been called"); + + mHasSurface = true; + s = createSurface(); + mClientSurfaceBinder = s->asBinder(); return s; } |
