=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Abort state application when there is problem with newly created sampler object.

Alexandre Julliard julliard at winehq.org
Mon Mar 20 17:16:46 CDT 2017


Module: wine
Branch: master
Commit: de0a88538c9f8554a8658a90c5d4175121647aaa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=de0a88538c9f8554a8658a90c5d4175121647aaa

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Mar 20 12:13:09 2017 +0100

wined3d: Abort state application when there is problem with newly created sampler object.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/state.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 409c161..8ff1b46 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3633,17 +3633,17 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
             if (FAILED(wined3d_sampler_create(device, &desc, NULL, &sampler)))
             {
                 ERR("Failed to create sampler.\n");
-                sampler = NULL;
+                return;
             }
-            else
+            if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1)
             {
-                if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1)
-                    ERR("Failed to insert sampler.\n");
+                ERR("Failed to insert sampler.\n");
+                wined3d_sampler_decref(sampler);
+                return;
             }
         }
 
-        if (sampler)
-            wined3d_sampler_bind(sampler, mapped_stage, texture, context);
+        wined3d_sampler_bind(sampler, mapped_stage, texture, context);
 
         /* Trigger shader constant reloading (for NP2 texcoord fixup) */
         if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT))




More information about the wine-cvs mailing list