From f664be88bc30dbc75cca622a42029a19701a7809 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 24 Aug 2026 13:00:35 +1000 Subject: [PATCH] [host] dxgi: clean up failed frame writes --- host/platform/Windows/capture/DXGI/src/dxgi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index a715e68d..2a691a90 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -1516,12 +1516,13 @@ static CaptureResult dxgi_getFrame( Texture * tex = &this->texture[this->texRIndex]; FrameDamage * damage = &this->frameDamage[frameBufferIndex]; + CaptureResult result = CAPTURE_RESULT_OK; if (this->backend->writeFrame) { - CaptureResult result = this->backend->writeFrame(frameBufferIndex, frame); + result = this->backend->writeFrame(frameBufferIndex, frame); if (result != CAPTURE_RESULT_OK) - return result; + goto cleanup; } else { @@ -1584,6 +1585,7 @@ static CaptureResult dxgi_getFrame( damage->count = -1; } +cleanup: this->backend->unmapTexture(this->texRIndex); tex->map = NULL; tex->state = TEXTURE_STATE_UNUSED; @@ -1591,7 +1593,7 @@ static CaptureResult dxgi_getFrame( if (++this->texRIndex == this->maxTextures) this->texRIndex = 0; - return CAPTURE_RESULT_OK; + return result; } static CaptureResult dxgi_releaseFrame(void)