Fix some FD lifecycle issues
Use unique_fd, it's cool
Bug: 186919605
Test: make, guessing from a pretty clear error message & documentation
Change-Id: Ied546565261708b7e4c2d220dce6d6a89725cc06
diff --git a/libs/hwui/renderthread/VulkanSurface.h b/libs/hwui/renderthread/VulkanSurface.h
index 7c25545..beb71b72 100644
--- a/libs/hwui/renderthread/VulkanSurface.h
+++ b/libs/hwui/renderthread/VulkanSurface.h
@@ -15,6 +15,7 @@
*/
#pragma once
+#include <android-base/unique_fd.h>
#include <system/graphics.h>
#include <system/window.h>
#include <vulkan/vulkan.h>
@@ -57,7 +58,7 @@
// -1 any other time. When valid, we own the fd, and must ensure it is
// closed: either by closing it explicitly when queueing the buffer,
// or by passing ownership e.g. to ANativeWindow::cancelBuffer().
- int dequeue_fence = -1;
+ base::unique_fd dequeue_fence;
bool dequeued = false;
uint32_t lastPresentedCount = 0;
bool hasValidContents = false;