[vlc-devel] [PATCH] direct3d11: fix crash when Direct3D11DestroyResources() is called twice

Steve Lhomme robux4 at gmail.com
Mon Jun 20 17:04:25 CEST 2016


From: Steve Lhomme <robux4 at gmail.com>

this happens is some cases where Open() fails
---
 modules/video_output/win32/direct3d11.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 987cb2a..37a04fb 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1633,15 +1633,25 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
     sys->d3dregion_count = 0;
 
     if (sys->d3drenderTargetView)
+    {
         ID3D11RenderTargetView_Release(sys->d3drenderTargetView);
+        sys->d3drenderTargetView = NULL;
+    }
     if (sys->d3ddepthStencilView)
+    {
         ID3D11DepthStencilView_Release(sys->d3ddepthStencilView);
+        sys->d3ddepthStencilView = NULL;
+    }
     if (sys->pSPUPixelShader)
+    {
         ID3D11VertexShader_Release(sys->pSPUPixelShader);
+        sys->pSPUPixelShader = NULL;
+    }
 #if defined(HAVE_ID3D11VIDEODECODER) && VLC_WINSTORE_APP
     if( sys->context_lock > 0 )
     {
         CloseHandle( sys->context_lock );
+        sys->context_lock = INVALID_HANDLE_VALUE;
     }
 #endif
 
-- 
2.7.0



More information about the vlc-devel mailing list