Subject: FVWM: FvwmButtons and Mouse 1,2,3...

From: Christopher Wolf <[email-masked]>
Date: Mon, 23 Jun 1997 19:16:33 -0500 (CDT)

If one creates an FvwmButtons button and specifies actions for mouse 1
and mouse 2, and then presses mouse 3 on it, the entire FvwmButtons
will die.  Granted, this can be prevented by specifying a mouse 3
action or a default action, but couldn't it also just beep or
something if there is no action?  Segfaulting seems a little harsh.

-W

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (Thomas Honigmann)
Date: Tue, 24 Jun 1997 23:58:13 +0200

Christopher Wolf <[email-masked]> wrote:
> will die.  

It seems that in the situation you describe a NULL pointer gets passed
to mystrncasecmp() which calls strlen() on it without checking and
that causes the segmentation fault.

> Granted, this can be prevented by specifying a mouse 3

Attached is a patch which hopefully does what you want. Maybe it would
also be a good idea to make mystrncasecmp() more robust?

By the way: I was looking around the code to see if how fvwm does the beeping.
I found that it always calls XBell(dpy,Scr.screen). I just don't understand
why this is better than XBell(dpy, 0). What am I missing?

Cheers,
Thomas

--- FvwmButtons.c~	Tue Jun 24 10:15:56 1997
+++ FvwmButtons.c	Tue Jun 24 19:52:41 1997
@@ -597,6 +597,11 @@
 	    RedrawButton(b,0);
 	    if(!(act=GetButtonAction(b,Event.xbutton.button)))
 	      act=GetButtonAction(b,0);
+	    if (!act) 
+	      {
+	        XBell(Dpy, 0);
+		break;
+	      }
 	    if(mystrncasecmp(act,"popup",5)!=0)
 	      break;
 	    else /* i.e. action is Popup */
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].