[PATCH] dix: In MakeWindowOptional: Fix crash if parentOptional->cursor is NULL.

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 24 18:11:59 PDT 2009


On Fri, Sep 25, 2009 at 12:05:35AM +0200, Kim Woelders wrote:
> 
> Signed-off-by: Kim Woelders <kim at woelders.dk>
> ---
>  dix/window.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/dix/window.c b/dix/window.c
> index caff1cb..d4bc41c 100644
> --- a/dix/window.c
> +++ b/dix/window.c
> @@ -3470,7 +3470,8 @@ MakeWindowOptional (WindowPtr pWin)
>      if (!pWin->cursorIsNone)
>      {
>  	optional->cursor = parentOptional->cursor;
> -	optional->cursor->refcnt++;
> +	if (optional->cursor)
> +	    optional->cursor->refcnt++;
>      }
>      else
>      {
> -- 
> 1.6.4.4
 
Out of interest, what's the test scenario for that?

I've looked at the code and can't find the trigger. If (!pWin->cursorIsNone),
the window has to have a cursor set (and thus already have a WindowOptional).
If the parent had a cursor and it was inherited here, then setting the
parent to a NoneCursor should patch up the child accordingly anyway.
So right now, I'm not sure about the actual flow to trigger that and worry
that it may be part of a larger screwup.

Cheers,
  Peter


More information about the xorg-devel mailing list