D3DRM Implementation patches upto CreateDeviceFromSurface

Stefan Dösinger stefandoesinger at gmail.com
Thu Jul 30 04:57:37 CDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

- From patch 1:

> +    hr = init_device(object, 1, iface, ddraw, render_target, width, height);
> +    if (FAILED(hr))
> +        d3drm_device_destroy(object);
> +    else
> +        *device = IDirect3DRMDevice_from_impl(object);
Aren't you leaking ddraw here? It's possible that d3drm_device_destroy destroys it because ddraw is stored in object, but the caller doesn't know this. I'd be better to explicitly destroy it.

What about render_target in this case? Clipper isn't a problem because you didn't create it - the application did.

> +HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface)
> ...
> +    hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &render_target, NULL);
> +    if (FAILED(hr))
> +        return hr;
Here you have to release clipper (because you addref'ed it) and the primary surface.

You can avoid the clipper release by addrefing it after the CreateSurface call. AddRef never fails.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVufURAAoJEN0/YqbEcdMwgCQP/06Ed03h8q0pbbk7IuVO+9aU
yVkglF4i+Wlw1JqM0qqIPeJg2pGd166qMdofiP29fks62Pp231A4kIvEcRGteBJf
stRWLLGyBsPGPWf+UB5SmT2Qi6rT48LQE9aDi82LvXlzHTA4itHhCtjxQgoAwFLk
hp7Wu6Fx6Rm6TtjijmBIpp2y3o42w+nTjdwGWFEgWSnwKk0oqHYDTHZbkvJE9h1K
vbriLQIO7yAE2/4C+mWmMiOlVHXksgDttUOFtG1dqb0Xg3mo/rERd/5HwHRntnKi
rVkc1W2ahagrmrckf72airTAyEwhO7RqAoqjW0zioHrBpU/xoUkxQuiMcrjyndGj
2yTeZ3Lrd4LRJhIKVJdCnzXhFLYEg2i0iUjAduh0UVERJw0ya6B43Rz4XgKjBXJ4
2mWK9NVkfSy+IZ5lpKZbUYQhNu+nO7BQtGm9CNjtHj13xt5KXy6MDaB4NiICOk2N
IMyymeuQl9TF+nWjw80qQohONYOwL7ty5e5oUSbiKdmlNeqGLNbZPhT5HH/NaqUP
WQ4qv+2br3n5p4IPFxmm54gvelcVdL39sC2/7bd9GUikvB2n0iESbtDNpZo1dvuM
R5v7tG+uvsz4jpiJ/xIW5eKy0naYHP/Ri1cXQHqbG5ogGbPY9EKXo59TQvuhfkGa
JES0dpGT/kJI2cW2bQoR
=DeiB
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list