On 10 October 2011 08:07, Octavian Voicu octavian.voicu@gmail.com wrote:
+static HRESULT delete_attached_surface_helper(IDirectDrawSurfaceImpl *root, IDirectDrawSurfaceImpl *detach) +{
- if (detach->attached_iface == &detach->IDirectDrawSurface4_iface)
- return IDirectDrawSurface4_DeleteAttachedSurface(&root->IDirectDrawSurface4_iface, 0,
- &detach->IDirectDrawSurface4_iface);
- else if (detach->attached_iface == &detach->IDirectDrawSurface3_iface)
- return IDirectDrawSurface3_DeleteAttachedSurface(&root->IDirectDrawSurface3_iface, 0,
- &detach->IDirectDrawSurface3_iface);
- else if (detach->attached_iface == &detach->IDirectDrawSurface2_iface)
- return IDirectDrawSurface2_DeleteAttachedSurface(&root->IDirectDrawSurface2_iface, 0,
- &detach->IDirectDrawSurface2_iface);
- else if (detach->attached_iface == &detach->IDirectDrawSurface_iface)
- return IDirectDrawSurface_DeleteAttachedSurface(&root->IDirectDrawSurface_iface, 0,
- &detach->IDirectDrawSurface_iface);
- else if (detach->attached_iface != &detach->IDirectDrawSurface7_iface)
- FIXME("attached_iface %p is invalid for surface %p\n", detach->attached_iface, detach);
- return IDirectDrawSurface7_DeleteAttachedSurface(&root->IDirectDrawSurface7_iface, 0,
- &detach->IDirectDrawSurface7_iface);
+}
Can't you just handle this in ddraw_surface_delete_attached_surface()? I.e., replace the Release calls in ddraw_surface?_DeleteAttachedSurface() with a IUnknown_Release(Surf->attached_iface) in ddraw_surface_delete_attached_surface(), and then just call ddraw_surface_delete_attached_surface() where you're using delete_attached_surface_helper() now.
On Mon, Oct 10, 2011 at 10:04 AM, Henri Verbeet hverbeet@gmail.com wrote:
Can't you just handle this in ddraw_surface_delete_attached_surface()? I.e., replace the Release calls in ddraw_surface?_DeleteAttachedSurface() with a IUnknown_Release(Surf->attached_iface) in ddraw_surface_delete_attached_surface(), and then just call ddraw_surface_delete_attached_surface() where you're using delete_attached_surface_helper() now.
This is much clever! I'll resend the patches, thanks.
Octavian