diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index a2ae53cc41..09d8ac12e5 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -1848,6 +1848,10 @@ MaybeError ImportedTextureBase::OnAfterSubmit() { // The submit succeeded, we can replace the previous external semaphore with the pending one. if (mExternalSemaphoreHandle != kNullExternalSemaphoreHandle) { device->GetExternalSemaphoreService()->CloseHandle(mExternalSemaphoreHandle); + // Reset BEFORE the DAWN_TRY_ASSIGN below: if ExportSemaphore() fails the macro + // returns without writing the LHS, and ~ImportedTextureBase() would otherwise + // close() the stale FD value a second time. + mExternalSemaphoreHandle = kNullExternalSemaphoreHandle; } DAWN_TRY_ASSIGN(mExternalSemaphoreHandle,