summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2015-04-30 16:34:11 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-04-30 16:34:11 +0000
commitf0c17b0831512cc700414d12dee1e84fb174bbbe (patch)
tree2f446e34ccc34cde4e79b267dd6812ab49ae4e3d
parent8de71a2408f632407c25942a39c31f78c7f64ffd (diff)
parentdcfe91e1f3f15b68793a69650f9bd0ca6a58ff4c (diff)
Merge "Avoid closing invalid FD in Surface and GraphicBufferMapper"
-rw-r--r--libs/ui/GraphicBufferMapper.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 31bfb2d0fc..b03e8d6bd0 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -131,8 +131,10 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr, fenceFd);
} else {
- sync_wait(fenceFd, -1);
- close(fenceFd);
+ if (fenceFd >= 0) {
+ sync_wait(fenceFd, -1);
+ close(fenceFd);
+ }
err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr);
@@ -154,8 +156,10 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
static_cast<int>(usage), bounds.left, bounds.top,
bounds.width(), bounds.height(), ycbcr, fenceFd);
} else if (mAllocMod->lock_ycbcr != NULL) {
- sync_wait(fenceFd, -1);
- close(fenceFd);
+ if (fenceFd >= 0) {
+ sync_wait(fenceFd, -1);
+ close(fenceFd);
+ }
err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr);