Module: wine Branch: master Commit: ebcf08e59a3317a997e0ff7bad03c888260b9991 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ebcf08e59a3317a997e0ff7bad...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Jun 28 02:26:20 2011 +0200
wined3d: Properly destroy contexts not owned by the implcit swapchain.
In particular, set num_contexts to 0 in the swapchain that owns the contexts.
---
dlls/wined3d/device.c | 4 ++-- dlls/wined3d/swapchain.c | 11 +++++++++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6314372..180fd49 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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. */ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index fb09ccf..a64c0db 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -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(); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e96b7ad..a3e12ff 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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