[PATCH 4/5] wined3d: Merge the IWineD3DSwapChain::Destroy() implementations.

Henri Verbeet hverbeet at gmail.com
Fri Apr 8 07:37:06 CDT 2011


On 8 April 2011 14:08, Alexandre Julliard <julliard at winehq.org> wrote:
> =>0 0x687550fa context_destroy+0x2a(This=0x134d58, context=(nil)) [/home/julliard/wine/wine/dlls/wined3d/context.c:1615] in wined3d (0x0032f948)
>  1 0x6880052b IWineD3DBaseSwapChainImpl_Destroy+0x18a(iface=0x131848) [/home/julliard/wine/wine/dlls/wined3d/swapchain.c:65] in wined3d (0x0032f9a8)

Applying the attached patch anywhere before 4 should help. Would you
like a new series?
-------------- next part --------------
commit 631daee9379ca76f614d7e3dfc04915c5ec70008
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Apr 8 14:30:59 2011 +0200

    wined3d: Only create a swapchain context array for GL swapchains.
    
    Lying about the number of contexts a swapchain has isn't very useful.

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 1c875bf..ddd946d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1043,15 +1043,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
         displaymode_set = TRUE;
     }
 
-    swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context));
-    if (!swapchain->context)
-    {
-        ERR("Failed to create the context array.\n");
-        hr = E_OUTOFMEMORY;
-        goto err;
-    }
-    swapchain->num_contexts = 1;
-
     if (surface_type == SURFACE_OPENGL)
     {
         static const enum wined3d_format_id formats[] =
@@ -1065,6 +1056,15 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
 
         const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
 
+        swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context));
+        if (!swapchain->context)
+        {
+            ERR("Failed to create the context array.\n");
+            hr = E_OUTOFMEMORY;
+            goto err;
+        }
+        swapchain->num_contexts = 1;
+
         /* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate.
          * You are able to add a depth + stencil surface at a later stage when you need it.
          * In order to support this properly in WineD3D we need the ability to recreate the opengl context and
@@ -1099,10 +1099,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
         }
         context_release(swapchain->context[0]);
     }
-    else
-    {
-        swapchain->context[0] = NULL;
-    }
 
     if (swapchain->presentParms.BackBufferCount > 0)
     {


More information about the wine-devel mailing list