Henri Verbeet : ddraw: Clear attached_iface before releasing it in ddraw_surface_delete_attached_surface ().

Alexandre Julliard julliard at winehq.org
Wed Oct 19 14:05:24 CDT 2011


Module: wine
Branch: master
Commit: 4408c5abc643bdbd2041f41eff955f2cc34f9d4e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4408c5abc643bdbd2041f41eff955f2cc34f9d4e

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Oct 18 20:46:12 2011 +0200

ddraw: Clear attached_iface before releasing it in ddraw_surface_delete_attached_surface().

Spotted by Dan Kegel / Valgrind.

---

 dlls/ddraw/surface.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index a673806..c01ac45 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1590,8 +1590,12 @@ static HRESULT ddraw_surface_delete_attached_surface(IDirectDrawSurfaceImpl *Thi
         IDirect3DDeviceImpl_UpdateDepthStencil(This->ddraw->d3ddevice);
     }
     LeaveCriticalSection(&ddraw_cs);
-    IUnknown_Release(Surf->attached_iface);
+
+    /* Set attached_iface to NULL before releasing it, the surface may go
+     * away. */
     Surf->attached_iface = NULL;
+    IUnknown_Release(detach_iface);
+
     return DD_OK;
 }
 




More information about the wine-cvs mailing list