Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- If this seems sensible, I'll write a similar patch for blend state objects.
dlls/wined3d/device.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0f52b0dea2e..4b247b9b76f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -518,11 +518,11 @@ static void device_leftover_sampler(struct wine_rb_entry *entry, void *context) ERR("Leftover sampler %p.\n", sampler); }
-static void device_free_rasterizer_state(struct wine_rb_entry *entry, void *context) +static void device_leftover_rasterizer_state(struct wine_rb_entry *entry, void *context) { struct wined3d_rasterizer_state *state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_rasterizer_state, entry);
- wined3d_rasterizer_state_decref(state); + ERR("Leftover rasterizer state %p.\n", state); }
static void device_free_blend_state(struct wine_rb_entry *entry, void *context) @@ -539,7 +539,6 @@ void wined3d_device_cleanup(struct wined3d_device *device) if (device->swapchain_count) wined3d_device_uninit_3d(device);
- wine_rb_destroy(&device->rasterizer_states, device_free_rasterizer_state, NULL); wine_rb_destroy(&device->blend_states, device_free_blend_state, NULL);
wined3d_cs_destroy(device->cs); @@ -570,6 +569,7 @@ void wined3d_device_cleanup(struct wined3d_device *device) device->hardwareCursor = 0;
wine_rb_destroy(&device->samplers, device_leftover_sampler, NULL); + wine_rb_destroy(&device->rasterizer_states, device_leftover_rasterizer_state, NULL);
wined3d_decref(device->wined3d); device->wined3d = NULL; @@ -1111,6 +1111,13 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context) wined3d_sampler_decref(sampler); }
+static void device_free_rasterizer_state(struct wine_rb_entry *entry, void *context) +{ + struct wined3d_rasterizer_state *state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_rasterizer_state, entry); + + wined3d_rasterizer_state_decref(state); +} + void wined3d_device_uninit_3d(struct wined3d_device *device) { BOOL no3d = device->wined3d->flags & WINED3D_NO3D; @@ -1151,6 +1158,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device) }
wine_rb_clear(&device->samplers, device_free_sampler, NULL); + wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { @@ -5330,6 +5338,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, }
wine_rb_clear(&device->samplers, device_free_sampler, NULL); + wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL);
if (reset_state) {