[PATCH] ddrawex: Don't leak surfaces.
hverbeet at gmail.com
Thu Sep 4 08:24:05 CDT 2014
On 4 September 2014 13:18, Stefan Dösinger <stefan at codeweavers.com> wrote:
> dds_get_outer AddRefs the inner surface when it creates the wrapper
> surface. The wrapper releases only one reference when it is destroyed,
> leaking one of the two. AddRefing in dds_get_outer makes sense because
> this is also used by e.g. GetAttachedSurface, where it creates a new
> wrapper for surfaces ddrawex didn't know about yet.
> Whether native ddrawex.dll properly handles GetAttachedSurfaces and
> friends is an open question. We already know it doesn't properly handle
> IDirectDraw4::GetSurfaceFromDC, even though the equivalent ddraw3 method
On a related note, I think it's unfortunate that dds_get_outer()
creates a wrapper surface with refcount 1 if it doesn't exist yet, but
doesn't AddRef() existing interfaces when returning them. That means
the caller effectively needs to know if the wrapper already exists or
not in order to do proper refcounting.
More information about the wine-devel