[PATCH:libXScrnSaver] Copy root field from wire event into root, not window, of Xlib event

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 8 16:02:54 PST 2013


On Sun, Dec 08, 2013 at 10:04:15AM -0800, Alan Coopersmith wrote:
> Fixes cppcheck warning:
> [src/XScrnSaver.c:104] -> [src/XScrnSaver.c:105]: (performance, inconclusive)
>  Variable 'window' is reassigned a value before the old one has been
>  used if variable is no semaphore variable.
> 
> Error seems to date back to revision 1.1 in X Consortium RCS,
> dated 1992-02-13, by "keith"
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/XScrnSaver.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> While this seems more correct, and fills in a field left uninitialized
> before, I do wonder if after 21 years, applications all expect the root
> window id in the window field of the event now, and if they'll be broken
> by this.

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

> diff --git a/src/XScrnSaver.c b/src/XScrnSaver.c
> index 2a89246..3947dd5 100644
> --- a/src/XScrnSaver.c
> +++ b/src/XScrnSaver.c
> @@ -102,7 +102,7 @@ static Bool wire_to_event (
>      	se->send_event = (sevent->type & 0x80) != 0;
>      	se->display = dpy;
>      	se->window = sevent->window;
> -    	se->window = sevent->root;
> +	se->root = sevent->root;
>      	se->state = sevent->state;
>  	se->kind = sevent->kind;
>  	se->forced = True;
> -- 
> 1.7.9.2
> 


More information about the xorg-devel mailing list