[PATCH] exa: check for valid SourceValidate callback ptr

Michel Dänzer michel at daenzer.net
Mon Apr 12 02:43:49 PDT 2010


On Fri, 2010-04-09 at 19:26 +0200, Jerome Glisse wrote: 
> During rotation the screen SourceValidate ptr is set to NULL
> (see hw/xfree86/modes/xf86Rotate.c xf86RotateRedisplay) to avoid
> segfaulting in exa unaccelerated path check for a valid SourceValidate
> ptr.
> 
> Signed-off-by: Jerome Glisse <jglisse at redhat.com>
> ---
>  exa/exa_unaccel.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
> index b4ead7f..d4133bf 100644
> --- a/exa/exa_unaccel.c
> +++ b/exa/exa_unaccel.c
> @@ -465,7 +465,9 @@ ExaSrcValidate(DrawablePtr pDrawable,
>      REGION_UNINIT(pScreen, &reg);
>  
>      swap(pExaScr, pScreen, SourceValidate);
> -    pScreen->SourceValidate(pDrawable, x, y, width, height);
> +    if (pScreen->SourceValidate) {
> +        pScreen->SourceValidate(pDrawable, x, y, width, height);
> +    }
>      swap(pExaScr, pScreen, SourceValidate);
>  }

It would be slightly better to write this as

    if (pExaScr->SavedSourceValidate) {
swap(pExaScr, pScreen, SourceValidate);
pScreen->SourceValidate(pDrawable, x, y, width, height);
swap(pExaScr, pScreen, SourceValidate);
    }

But you have my

Acked-by: Michel Dänzer <michel at daenzer.net>

in either case.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer






More information about the xorg-devel mailing list