From 274b091c87a564f955f7dcef7f5f5508b6997f97 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 15 Feb 2017 14:17:13 +0100 Subject: [PATCH] wined3d: Free the swapchain context array in swapchain_destroy_contexts(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/device.c | 7 ++----- dlls/wined3d/swapchain.c | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 64524208e50..127136332c5 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4528,7 +4528,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) } } -static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) +static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; struct wined3d_context *context; @@ -4561,9 +4561,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d else context_destroy(device, device->contexts[0]); } - - HeapFree(GetProcessHeap(), 0, swapchain->context); - swapchain->context = NULL; } static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) @@ -4827,7 +4824,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, state_cleanup(&device->state); if (device->d3d_initialized) - delete_opengl_contexts(device, swapchain); + wined3d_device_delete_opengl_contexts(device); state_init(&device->state, &device->fb, &device->adapter->gl_info, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index dfb62c8bafa..f5fdd968fa7 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1136,7 +1136,9 @@ void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) { context_destroy(swapchain->device, swapchain->context[i]); } + HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->num_contexts = 0; + swapchain->context = NULL; } struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain)