ddraw: SetClipper refcounting fix.

This commit is contained in:
Stefan Dösinger 2007-02-16 19:08:21 +01:00 committed by Alexandre Julliard
parent 266fc77cf0
commit ae91cfe380
1 changed files with 4 additions and 3 deletions

View File

@ -1882,17 +1882,18 @@ IDirectDrawSurfaceImpl_SetClipper(IDirectDrawSurface7 *iface,
IDirectDrawClipper *Clipper) IDirectDrawClipper *Clipper)
{ {
ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface); ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirectDrawSurface7, iface);
IDirectDrawClipperImpl *oldClipper = This->clipper;
TRACE("(%p)->(%p)\n",This,Clipper); TRACE("(%p)->(%p)\n",This,Clipper);
if (ICOM_OBJECT(IDirectDrawClipperImpl, IDirectDrawClipper, Clipper) == This->clipper) if (ICOM_OBJECT(IDirectDrawClipperImpl, IDirectDrawClipper, Clipper) == This->clipper)
return DD_OK; return DD_OK;
if (This->clipper != NULL)
IDirectDrawClipper_Release(ICOM_INTERFACE(This->clipper, IDirectDrawClipper) );
This->clipper = ICOM_OBJECT(IDirectDrawClipperImpl, IDirectDrawClipper, Clipper); This->clipper = ICOM_OBJECT(IDirectDrawClipperImpl, IDirectDrawClipper, Clipper);
if (Clipper != NULL) if (Clipper != NULL)
IDirectDrawClipper_AddRef(Clipper); IDirectDrawClipper_AddRef(Clipper);
if(oldClipper)
IDirectDrawClipper_Release(ICOM_INTERFACE(oldClipper, IDirectDrawClipper));
return DD_OK; return DD_OK;
} }