wined3d_resource_free_sysmem() uses wined3d_resource.heap_pointer to deallocate wined3d_resource.heap_memory. Preserve pairing of heap_pointer/heap_memory to prevent deallocation of incorrect heap_memory.
From: Panayiotis Talianos panintended.foss@gmail.com
wined3d_resource_free_sysmem() uses wined3d_resource.heap_pointer to deallocate wined3d_resource.heap_memory. Preserve pairing of heap_pointer/heap_memory to prevent deallocation of incorrect heap_memory.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57387 --- dlls/wined3d/swapchain.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 2811e588ecd..507d6e64bd8 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1319,7 +1319,8 @@ static void swapchain_gdi_present(struct wined3d_swapchain *swapchain, { struct wined3d_dc_info *front, *back; HBITMAP bitmap; - void *data; + void *heap_pointer; + void *heap_memory; HDC dc;
front = &swapchain->front_buffer->dc_info[0]; @@ -1328,15 +1329,18 @@ static void swapchain_gdi_present(struct wined3d_swapchain *swapchain, /* Flip the surface data. */ dc = front->dc; bitmap = front->bitmap; - data = swapchain->front_buffer->resource.heap_memory; + heap_pointer = swapchain->front_buffer->resource.heap_pointer; + heap_memory = swapchain->front_buffer->resource.heap_memory;
front->dc = back->dc; front->bitmap = back->bitmap; + swapchain->front_buffer->resource.heap_pointer = swapchain->back_buffers[0]->resource.heap_pointer; swapchain->front_buffer->resource.heap_memory = swapchain->back_buffers[0]->resource.heap_memory;
back->dc = dc; back->bitmap = bitmap; - swapchain->back_buffers[0]->resource.heap_memory = data; + swapchain->back_buffers[0]->resource.heap_pointer = heap_pointer; + swapchain->back_buffers[0]->resource.heap_memory = heap_memory;
SetRect(&swapchain->front_buffer_update, 0, 0, swapchain->front_buffer->resource.width,