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

Alan Coopersmith alan.coopersmith at oracle.com
Sun Dec 8 10:04:15 PST 2013


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.

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