[PATCH 1/2] ddraw: Handle refcount of lights when interacting with viewport. (try 2)
Christian Costa
titan.costa at wanadoo.fr
Mon Apr 20 14:19:28 CDT 2009
---
This time with Henri's suggestion.
0 files changed, 0 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index 30d5e18..2631922 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -751,6 +751,7 @@ IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
/* Add the light in the 'linked' chain */
lpDirect3DLightImpl->next = This->lights;
This->lights = lpDirect3DLightImpl;
+ IDirect3DLight_AddRef(lpDirect3DLight);
/* Attach the light to the viewport */
lpDirect3DLightImpl->active_viewport = This;
@@ -796,6 +797,7 @@ IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface,
else prev_light->next = cur_light->next;
/* Detach the light to the viewport */
cur_light->active_viewport = NULL;
+ IDirect3DLight_Release(cur_light);
This->num_lights--;
This->map_lights &= ~(1<<lpDirect3DLightImpl->dwLightIndex);
LeaveCriticalSection(&ddraw_cs);
@@ -871,6 +873,9 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
break;
}
+ if (*lplpDirect3DLight)
+ IDirect3DLight_AddRef(*lplpDirect3DLight);
+
LeaveCriticalSection(&ddraw_cs);
return *lplpDirect3DLight ? D3D_OK : DDERR_INVALIDPARAMS;
More information about the wine-patches
mailing list