chiark / gitweb /
xduplic-copier: do not call XmuClientWindow on a null subwindow
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Nov 2013 19:38:27 +0000 (19:38 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Nov 2013 19:38:27 +0000 (19:38 +0000)
If you click on the root window, xduplic-copier gets an event with
subwindow==0.  Current XmuClientWindow crashes if you call it with a
null window.

Instead, shortcut this: look for subwindow==0 as the way to tell it's
the root window.

cprogs/xduplic-copier.c

index 8c1da088778747cc196df8f9cb2de07004d91e46..80374f96fc5a8d57c7b1f5fbfdd3baae235688d4 100644 (file)
@@ -144,8 +144,7 @@ static void buttonpress(XButtonEvent *e) {
 
   if (e->window != e->root) return;
 
 
   if (e->window != e->root) return;
 
-  sw= XmuClientWindow(display, e->subwindow);
-  if (!sw) {
+  if (!e->subwindow) {
     if (!rightbutton) {
       stopselecting();
     } else {
     if (!rightbutton) {
       stopselecting();
     } else {
@@ -160,6 +159,8 @@ static void buttonpress(XButtonEvent *e) {
     return;
   }
 
     return;
   }
 
+  sw= XmuClientWindow(display, e->subwindow);
+
   if (sw == w) { beep(); return; }
 
   for (ownp=&headwn;
   if (sw == w) { beep(); return; }
 
   for (ownp=&headwn;