diff options
author | 2009-07-28 19:17:54 -0700 | |
---|---|---|
committer | 2009-07-28 19:17:54 -0700 | |
commit | 672136f3e64f8ead215d99da52e780f6f87a133e (patch) | |
tree | 34c970167190d0b4813e258e3061a06c04464b81 /libs/surfaceflinger/LayerBitmap.cpp | |
parent | 1c8ffbc728071f28aafda445428b6cf65bb25685 (diff) |
fix [1985856] Seg fault when using the soft keyboard in the Messaging app
Diffstat (limited to 'libs/surfaceflinger/LayerBitmap.cpp')
-rw-r--r-- | libs/surfaceflinger/LayerBitmap.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/libs/surfaceflinger/LayerBitmap.cpp b/libs/surfaceflinger/LayerBitmap.cpp index 9fffbbfbb9..ff49c87db3 100644 --- a/libs/surfaceflinger/LayerBitmap.cpp +++ b/libs/surfaceflinger/LayerBitmap.cpp @@ -177,22 +177,17 @@ status_t LayerBitmap::setSize(uint32_t w, uint32_t h) sp<Buffer> LayerBitmap::allocate() { Mutex::Autolock _l(mLock); - sp<Buffer> buffer(mBuffer); - const uint32_t w = mWidth; - const uint32_t h = mHeight; - if (buffer!=0 && (w != buffer->getWidth() || h != buffer->getHeight())) { - surface_info_t* info = mInfo; - buffer = new Buffer(w, h, mFormat, mFlags); - status_t err = buffer->initCheck(); - if (LIKELY(err == NO_ERROR)) { - info->flags = surface_info_t::eBufferDirty; - info->status = NO_ERROR; - } else { - memset(info, 0, sizeof(surface_info_t)); - info->status = NO_MEMORY; - } - mBuffer = buffer; + surface_info_t* info = mInfo; + sp<Buffer> buffer = new Buffer(mWidth, mHeight, mFormat, mFlags); + status_t err = buffer->initCheck(); + if (LIKELY(err == NO_ERROR)) { + info->flags = surface_info_t::eBufferDirty; + info->status = NO_ERROR; + } else { + memset(info, 0, sizeof(surface_info_t)); + info->status = NO_MEMORY; } + mBuffer = buffer; return buffer; } |