Commit ebcf08e5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Properly destroy contexts not owned by the implcit swapchain.

In particular, set num_contexts to 0 in the swapchain that owns the contexts.
parent 560d5188
......@@ -5547,11 +5547,11 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
while (device->context_count)
{
context_destroy(device, device->contexts[0]);
swapchain_destroy_contexts(device->contexts[0]->swapchain);
}
HeapFree(GetProcessHeap(), 0, swapchain->context);
swapchain->context = NULL;
swapchain->num_contexts = 0;
}
/* Do not call while under the GL lock. */
......
......@@ -1164,6 +1164,17 @@ static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain
return ctx;
}
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain)
{
unsigned int i;
for (i = 0; i < swapchain->num_contexts; ++i)
{
context_destroy(swapchain->device, swapchain->context[i]);
}
swapchain->num_contexts = 0;
}
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain)
{
DWORD tid = GetCurrentThreadId();
......
......@@ -2493,6 +2493,7 @@ struct wined3d_swapchain
void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
#define DEFAULT_REFRESH_RATE 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment