[vlc-commits] direct3d11: avoid a potential crash

Steve Lhomme git at videolan.org
Mon Feb 12 17:14:31 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 12 15:21:11 2018 +0100| [e407cf0fd40e7aed0a58d49b27773409a0455834] | committer: Steve Lhomme

direct3d11: avoid a potential crash

It should not happen but it seems that Manage could be called when the resources
have been destroyed.

Ref 4d56256c-20a1-4238-8c2a-f9c80b579900

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e407cf0fd40e7aed0a58d49b27773409a0455834
---

 modules/video_output/win32/direct3d11.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 48e261cc07..57d68ba9d5 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -2552,6 +2552,9 @@ static bool UpdateQuadPosition( vout_display_t *vd, d3d_quad_t *quad,
     HRESULT hr;
     D3D11_MAPPED_SUBRESOURCE mappedResource;
 
+    if (unlikely(quad->pVertexBuffer == NULL))
+        return false;
+
     /* create the vertices */
     hr = ID3D11DeviceContext_Map(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
     if (FAILED(hr)) {



More information about the vlc-commits mailing list