[9/10] WineD3D: Swap the SFLAG_DIBSECTION flag when swaping hdc and memory

Stefan Dösinger stefan at codeweavers.com
Tue Feb 13 13:25:48 CST 2007


This fixes the crash on exit with the directx7 sdk samples
-------------- next part --------------
From 54b6626d7e3eb17f76fcaa530dfbba9632d67891 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Mon, 29 Jan 2007 23:05:32 +0100
Subject: [PATCH] WineD3D: Swap the SFLAG_DIBSECTION flag when swaping hdc and memory

---
 dlls/wined3d/swapchain.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 00f36de..52271df 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -305,9 +305,15 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
         /* Flip the DIBsection */
         {
             HBITMAP tmp;
+            BOOL hasDib = front->Flags & SFLAG_DIBSECTION;
             tmp = front->dib.DIBsection;
             front->dib.DIBsection = back->dib.DIBsection;
             back->dib.DIBsection = tmp;
+
+            if(back->Flags & SFLAG_DIBSECTION) front->Flags |= SFLAG_DIBSECTION;
+            else front->Flags &= ~SFLAG_DIBSECTION;
+            if(hasDib) back->Flags |= SFLAG_DIBSECTION;
+            else back->Flags &= ~SFLAG_DIBSECTION;
         }
 
         /* Flip the surface data */
-- 
1.4.4.3



More information about the wine-patches mailing list