From 73a2597c8acc8861b070ee4f51923b5aaaed574b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 27 Sep 2018 12:49:52 +1000 Subject: [PATCH] [dxgi] fix crash caused by failure to release in some instances. --- host/Capture/DXGI.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host/Capture/DXGI.cpp b/host/Capture/DXGI.cpp index b8e7eea5..40142070 100644 --- a/host/Capture/DXGI.cpp +++ b/host/Capture/DXGI.cpp @@ -353,8 +353,6 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs if (!m_initialized) return GRAB_STATUS_ERROR; - ReleaseFrame(); - timeout = false; DXGI_OUTDUPL_FRAME_INFO frameInfo; IDXGIResourcePtr res; @@ -364,6 +362,10 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs { while (true) { + GrabStatus ret = ReleaseFrame(); + if (ret != GRAB_STATUS_OK) + return ret; + status = m_dup->AcquireNextFrame(1000, &frameInfo, &res); if (status == DXGI_ERROR_WAIT_TIMEOUT) {