Commit 90592714 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Check subresources for NULL during texture cleanup.

This fixes a regression introduced by 1de6adfb.
parent cc2cd5a5
......@@ -179,10 +179,12 @@ static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This)
for (i = 0; i < sub_count; ++i)
{
IWineD3DSurfaceImpl *surface = surface_from_resource(This->baseTexture.sub_resources[i]);
struct wined3d_resource *sub_resource = This->baseTexture.sub_resources[i];
if (surface)
if (sub_resource)
{
IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it. */
surface_set_texture_name(surface, 0, TRUE);
......
......@@ -201,9 +201,12 @@ static void texture_cleanup(IWineD3DTextureImpl *This)
for (i = 0; i < This->baseTexture.level_count; ++i)
{
IWineD3DSurfaceImpl *surface = surface_from_resource(This->baseTexture.sub_resources[i]);
if (surface)
struct wined3d_resource *sub_resource = This->baseTexture.sub_resources[i];
if (sub_resource)
{
IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it */
surface_set_texture_name(surface, 0, TRUE);
......
......@@ -121,10 +121,12 @@ static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This)
for (i = 0; i < This->baseTexture.level_count; ++i)
{
IWineD3DVolumeImpl *volume = volume_from_resource(This->baseTexture.sub_resources[i]);
struct wined3d_resource *sub_resource = This->baseTexture.sub_resources[i];
if (volume)
if (sub_resource)
{
IWineD3DVolumeImpl *volume = volume_from_resource(sub_resource);
/* Cleanup the container. */
volume_set_container(volume, NULL);
IWineD3DVolume_Release((IWineD3DVolume *)volume);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment