Henri Verbeet : d3d8: Clear pBits and Pitch when d3d8_surface_LockRect() fails.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:55 CST 2014


Module: wine
Branch: stable
Commit: 991156264ad8ebbcd52a663070b51377c37c327f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=991156264ad8ebbcd52a663070b51377c37c327f

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Nov 12 11:00:25 2013 +0100

d3d8: Clear pBits and Pitch when d3d8_surface_LockRect() fails.

This is a only slightly modified version of a patch by Lasse Rasinen.
(cherry picked from commit b83a0b9d3ee88b5a09700bc3a25d3ae3a49aa84f)

---

 dlls/d3d8/surface.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 2196011..fed590f 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -273,8 +273,16 @@ static HRESULT WINAPI d3d8_surface_LockRect(IDirect3DSurface8 *iface,
     hr = wined3d_surface_map(surface->wined3d_surface, &map_desc, rect, flags);
     wined3d_mutex_unlock();
 
-    locked_rect->Pitch = map_desc.row_pitch;
-    locked_rect->pBits = map_desc.data;
+    if (SUCCEEDED(hr))
+    {
+        locked_rect->Pitch = map_desc.row_pitch;
+        locked_rect->pBits = map_desc.data;
+    }
+    else
+    {
+        locked_rect->Pitch = 0;
+        locked_rect->pBits = NULL;
+    }
 
     return hr;
 }




More information about the wine-cvs mailing list