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

In particular, set num_contexts to 0 in the swapchain that owns the contexts.
This commit is contained in:
Henri Verbeet 2011-06-28 02:26:20 +02:00 committed by Alexandre Julliard
parent 560d5188b7
commit ebcf08e59a
3 changed files with 14 additions and 2 deletions

View File

@ -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. */

View File

@ -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();

View File

@ -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