[vlc-devel] [PATCH] direct3d11: fix crash when D3D11 fails to find the compiler

Steve Lhomme robUx4 at videolabs.io
Mon Mar 23 09:22:08 CET 2015


---
 modules/video_output/msw/direct3d11.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index 18552ee..c486071 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -403,24 +403,27 @@ static void Direct3D11Destroy(vout_display_t *vd)
 
     vout_display_sys_t *sys = vd->sys;
 
+    if( sys != NULL )
+    {
 # if 0
-    if (sys->hdxgi_dll)
-        FreeLibrary(sys->hdxgi_dll);
+        if (sys->hdxgi_dll)
+            FreeLibrary(sys->hdxgi_dll);
 # endif
 
-    if (sys->hd3d11_dll)
-        FreeLibrary(sys->hd3d11_dll);
-    if (sys->hd3dcompiler_dll)
-        FreeLibrary(sys->hd3dcompiler_dll);
+        if (sys->hd3d11_dll)
+            FreeLibrary(sys->hd3d11_dll);
+        if (sys->hd3dcompiler_dll)
+            FreeLibrary(sys->hd3dcompiler_dll);
 
-    /* TODO : add release of d3d11 objects here */
+        /* TODO : add release of d3d11 objects here */
 
-    sys->OurD3D11CreateDevice = NULL;
-    sys->OurD3D11CreateDeviceAndSwapChain = NULL;
-    sys->OurD3DCompile = NULL;
-    sys->hdxgi_dll = NULL;
-    sys->hd3d11_dll = NULL;
-    sys->hd3dcompiler_dll = NULL;
+        sys->OurD3D11CreateDevice = NULL;
+        sys->OurD3D11CreateDeviceAndSwapChain = NULL;
+        sys->OurD3DCompile = NULL;
+        sys->hdxgi_dll = NULL;
+        sys->hd3d11_dll = NULL;
+        sys->hd3dcompiler_dll = NULL;
+    }
 #else
 
     VLC_UNUSED(vd);
-- 
2.3.2




More information about the vlc-devel mailing list