summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/system/window.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/system/window.h b/include/system/window.h
index 685e068..1e7f114 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -828,9 +828,8 @@ static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw,
int err = anw->dequeueBuffer(anw, anb, &fenceFd);
if (err == 0 && fenceFd != -1) {
err = sync_wait(fenceFd, UINT_MAX);
- if (err == 0) {
- close(fenceFd);
- } else {
+ close(fenceFd);
+ if (err != 0) {
anw->cancelBuffer(anw, *anb, fenceFd);
*anb = NULL;
}