[PATCH] wined3d: move texture reference decrement to end of usage (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Sep 29 04:14:54 CDT 2012


Hi,

I do not fully understand all this, but it seem the decref needs to
be behind the last usage of prev.

CID 714113

Ciao, Marcus
---
 dlls/wined3d/device.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 916a648..7346a02 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3524,8 +3524,6 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
     {
         LONG bind_count = InterlockedDecrement(&prev->resource.bind_count);
 
-        wined3d_texture_decref(prev);
-
         if (!texture && stage < gl_info->limits.texture_stages)
         {
             device_invalidate_state(device, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
@@ -3549,6 +3547,8 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
                 }
             }
         }
+
+        wined3d_texture_decref(prev);
     }
 
     device_invalidate_state(device, STATE_SAMPLER(stage));
-- 
1.7.3.4




More information about the wine-patches mailing list