[resend v2 4/4] ddraw: Do refcounting only through wined3d_texture_{inc, dec}ref().

Henri Verbeet hverbeet at gmail.com
Sun Jan 3 12:06:03 CST 2016


On 22 December 2015 at 22:43, Riccardo Bortolato <rikyz619 at gmail.com> wrote:
> @@ -1227,6 +1221,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
>      struct wined3d_texture *texture;
>      IDirectDrawSurface7 *current;
>      struct wined3d_surface *tmp;
> +    unsigned int tmp_idx;
You shouldn't need that. Flippable surfaces aren't supposed to be
textures, and only textures should have mip-levels. It should be
enough to validate the sub-resource index is 0 and print an ERR if it
somehow isn't. I don't think we enforce that DDSCAPS_MIPMAP needs
DDSCAPS_TEXTURE. That would be a bug and needs tests.

> @@ -6286,8 +6287,10 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, stru
>      }
>      desc->lpSurface = NULL;
>
> -    wined3d_surface_incref(wined3d_surface);
> +    wined3d_texture_incref(wined3d_texture);
>      surface->wined3d_surface = wined3d_surface;
> +    surface->wined3d_texture = wined3d_texture;
The reference counting here is odd. You'd normally increment the
reference count right before or after storing the pointer.

You also store wined3d_surface without increasing the reference count,
although that's probably ok because it's protected by the one from the
texture. Still, it would probably be nicer to just get rid of the
wined3d_surface field first.



More information about the wine-devel mailing list