wined3d: Initialize map_desc in wined3d_surface_map
Lasse Rasinen
lrasinen at iki.fi
Tue Oct 15 13:07:58 CDT 2013
Supersedes patches 99395, 99670 and 99682.
Fixes http://bugs.winehq.org/show_bug.cgi?id=34271
---
dlls/d3d8/tests/device.c | 4 ++++
dlls/d3d9/tests/device.c | 4 ++++
dlls/wined3d/surface.c | 3 +++
3 files changed, 11 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 7932a7f..090a568 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -4022,8 +4022,12 @@ static void test_lockrect_invalid(void)
hr = IDirect3DSurface8_LockRect(surface, &locked_rect, NULL, 0);
ok(SUCCEEDED(hr), "Failed to lock surface with rect NULL, hr %#x.\n", hr);
+ locked_rect.pBits = 0xdeadbeef;
+ locked_rect.Pitch = 1;
hr = IDirect3DSurface8_LockRect(surface, &locked_rect, NULL, 0);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(locked_rect.pBits == NULL, "pBits not cleared on double lock.\n");
+ ok(locked_rect.Pitch == 0, "Pitch not cleared on double lock.\n");
hr = IDirect3DSurface8_UnlockRect(surface);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 02b4174..43a592f 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5402,8 +5402,12 @@ static void test_lockrect_invalid(void)
hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
ok(SUCCEEDED(hr), "Failed to lock surface with rect NULL, hr %#x.\n", hr);
+ locked_rect.pBits = 0xdeadbeef;
+ locked_rect.Pitch = 1;
hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(locked_rect.pBits == NULL, "pBits not cleared on double lock.\n");
+ ok(locked_rect.Pitch == 0, "Pitch not cleared on double lock.\n");
hr = IDirect3DSurface9_UnlockRect(surface);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index daa26e2..7f5aac2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3458,6 +3458,9 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
TRACE("surface %p, map_desc %p, rect %s, flags %#x.\n",
surface, map_desc, wine_dbgstr_rect(rect), flags);
+ map_desc->data = NULL;
+ map_desc->row_pitch = 0;
+
if (surface->resource.map_count)
{
WARN("Surface is already mapped.\n");
--
1.7.12.4 (Apple Git-37)
More information about the wine-patches
mailing list