[PATCH 2/2] Xi: don't ring the device bell if we don't have one

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 26 17:02:26 PST 2013


On Tue, Feb 26, 2013 at 08:22:54AM +0100, Knut Petersen wrote:
> On 26.02.2013 04:35, Peter Hutterer wrote:
> >Test case: xts5/XI/DeviceBell (1/6)
> >
> >Reported-by: Knut Petersen <Knut_Petersen at t-online.de>
> >Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> >---
> >  Xi/devbell.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> >diff --git a/Xi/devbell.c b/Xi/devbell.c
> >index c75b94d..d4c9554 100644
> >--- a/Xi/devbell.c
> >+++ b/Xi/devbell.c
> >@@ -142,7 +142,9 @@ ProcXDeviceBell(ClientPtr client)
> >          newpercent = base + newpercent;
> >      else
> >          newpercent = base - newpercent + stuff->percent;
> >-    (*proc) (newpercent, dev, ctrl, class);
> >+
> >+    if (proc)
> >+        (*proc) (newpercent, dev, ctrl, class);
> >      return Success;
> 
> Still return Success?
> Minutes ago I prepared the attached alternative ...


> From 4f358019c9727ed96b8cdac689991681843bcc2d Mon Sep 17 00:00:00 2001
> From: Knut Petersen <Knut_Petersen at t-online.de>
> Date: Tue, 26 Feb 2013 07:52:59 +0100
> Subject: [PATCH] Never try to execute BellProcPtr NULL.
> 
> This prevents xts XI/XDeviceBell-2 test
> from segfaulting the server.
> 
> Signed-off-by: Knut Petersen <Knut_Petersen at t-online.de>
> ---
>  Xi/devbell.c |    3 ++-
>  1 Datei ge??ndert, 2 Zeilen hinzugef??gt(+), 1 Zeile entfernt(-)
> 
> diff --git a/Xi/devbell.c b/Xi/devbell.c
> index c75b94d..202c8de 100644
> --- a/Xi/devbell.c
> +++ b/Xi/devbell.c
> @@ -142,7 +142,8 @@ ProcXDeviceBell(ClientPtr client)
>          newpercent = base + newpercent;
>      else
>          newpercent = base - newpercent + stuff->percent;
> +    if (proc == NULL)
> +        return BadValue;
>      (*proc) (newpercent, dev, ctrl, class);
> -
>      return Success;
>  }
> -- 
> 1.7.10.4

works too, merged, thanks.

Cheers,
   Peter





More information about the xorg-devel mailing list