d3d8: Don't call Release() in a while loop.
Henri Verbeet
hverbeet at codeweavers.com
Tue Mar 10 03:19:05 CDT 2009
There should only ever be a single reference to these objects, since only
their handle is exposed outside d3d8. Should there be more references than
that, calling Release() in a while loop probably isn't the right approach.
---
dlls/d3d8/device.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 33edbe8..7c2d13b 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1302,7 +1302,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 if
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d8_cs);
- while(IUnknown_Release((IUnknown *)pSB));
+
+ if (IUnknown_Release((IUnknown *)pSB))
+ {
+ ERR("Stateblock %p has references left, this shouldn't happen.\n", pSB);
+ }
+
LeaveCriticalSection(&d3d8_cs);
return D3D_OK;
@@ -1910,7 +1915,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE
IWineD3DVertexShader_Release(cur);
}
- while(IUnknown_Release((IUnknown *)shader));
+ if (IUnknown_Release((IUnknown *)shader))
+ {
+ ERR("Shader %p has references left, this shouldn't happen.\n", shader);
+ }
+
free_shader_handle(This, handle);
}
LeaveCriticalSection(&d3d8_cs);
@@ -2164,7 +2173,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 i
IWineD3DPixelShader_Release(cur);
}
- while(IUnknown_Release((IUnknown *)shader));
+ if (IUnknown_Release((IUnknown *)shader))
+ {
+ ERR("Shader %p has references left, this shouldn't happen.\n", shader);
+ }
+
free_shader_handle(This, handle);
}
LeaveCriticalSection(&d3d8_cs);
--
1.6.0.6
--------------050405010205070706000405--
More information about the wine-patches
mailing list