[Mesa-dev] [PATCH 71/75] st/nine: handle possible failure of D3DWindowBuffer_create

Axel Davy axel.davy at ens.fr
Wed Oct 5 20:09:44 UTC 2016


From: Patrick Rudolph <siro at das-labor.org>

Check for errors and pass them to the callers.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/swapchain9.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index 5400dfc..d2aaa90 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -540,6 +540,10 @@ create_present_buffer( struct NineSwapChain9 *This,
     *resource = This->screen->resource_create(This->screen, &tmplt);
 
     *present_handle = D3DWindowBuffer_create(This, *resource, 24, true);
+
+    if (!*present_handle) {
+        pipe_resource_reference(resource, NULL);
+    }
 }
 
 static void
@@ -876,6 +880,10 @@ NineSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
      * mode. It may need a fix */
     create_present_buffer(This, width, height, &temp_resource, &temp_handle);
 
+    if (!temp_resource || !temp_handle) {
+        return D3DERR_INVALIDCALL;
+    }
+
     desc.Type = D3DRTYPE_SURFACE;
     desc.Pool = D3DPOOL_DEFAULT;
     desc.MultiSampleType = D3DMULTISAMPLE_NONE;
-- 
2.10.0



More information about the mesa-dev mailing list