ddraw: Don't operate on stored invalid clippers.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7593a7544d
commit
347efb985c
|
@ -33,7 +33,7 @@ static inline struct ddraw_clipper *impl_from_IDirectDrawClipper(IDirectDrawClip
|
|||
return CONTAINING_RECORD(iface, struct ddraw_clipper, IDirectDrawClipper_iface);
|
||||
}
|
||||
|
||||
static BOOL ddraw_clipper_is_valid(const struct ddraw_clipper *clipper)
|
||||
BOOL ddraw_clipper_is_valid(const struct ddraw_clipper *clipper)
|
||||
{
|
||||
/* Native is very lenient when you invoke the clipper methods with a clipper pointer that
|
||||
* points to something that is either not accessible or not a clipper, or if you break
|
||||
|
|
|
@ -391,6 +391,7 @@ struct ddraw_clipper
|
|||
|
||||
HRESULT ddraw_clipper_init(struct ddraw_clipper *clipper) DECLSPEC_HIDDEN;
|
||||
struct ddraw_clipper *unsafe_impl_from_IDirectDrawClipper(IDirectDrawClipper *iface) DECLSPEC_HIDDEN;
|
||||
BOOL ddraw_clipper_is_valid(const struct ddraw_clipper *clipper) DECLSPEC_HIDDEN;
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirectDrawPalette implementation structure
|
||||
|
|
|
@ -1549,6 +1549,12 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
|||
return hr;
|
||||
}
|
||||
|
||||
if (!ddraw_clipper_is_valid(dst_surface->clipper))
|
||||
{
|
||||
FIXME("Attempting to blit with an invalid clipper.\n");
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
scale_x = (float)(src_rect.right - src_rect.left) / (float)(dst_rect.right - dst_rect.left);
|
||||
scale_y = (float)(src_rect.bottom - src_rect.top) / (float)(dst_rect.bottom - dst_rect.top);
|
||||
|
||||
|
@ -4426,6 +4432,7 @@ static HRESULT WINAPI ddraw_surface7_GetClipper(IDirectDrawSurface7 *iface, IDir
|
|||
}
|
||||
|
||||
*clipper = &surface->clipper->IDirectDrawClipper_iface;
|
||||
if (ddraw_clipper_is_valid(surface->clipper))
|
||||
IDirectDrawClipper_AddRef(*clipper);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -4501,7 +4508,7 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface,
|
|||
|
||||
if (clipper != NULL)
|
||||
IDirectDrawClipper_AddRef(iclipper);
|
||||
if (old_clipper)
|
||||
if (old_clipper && ddraw_clipper_is_valid(old_clipper))
|
||||
IDirectDrawClipper_Release(&old_clipper->IDirectDrawClipper_iface);
|
||||
|
||||
if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && This->ddraw->wined3d_swapchain)
|
||||
|
@ -5782,7 +5789,7 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
|
|||
/* Reduce the ddraw surface count. */
|
||||
list_remove(&surface->surface_list_entry);
|
||||
|
||||
if (surface->clipper)
|
||||
if (surface->clipper && ddraw_clipper_is_valid(surface->clipper))
|
||||
IDirectDrawClipper_Release(&surface->clipper->IDirectDrawClipper_iface);
|
||||
|
||||
if (surface == surface->ddraw->primary)
|
||||
|
|
Loading…
Reference in New Issue