From fe859a9f34cc18a41f70e318e0d5a6e9020f9a8a Mon Sep 17 00:00:00 2001 From: matthieu Date: Wed, 27 Feb 2013 22:11:56 +0000 Subject: [PATCH] Merge patch from Tom Dickey for a segfault that happens when using the mouse wheel over the scrollbar. ok guenther@ deraadt@ --- app/xterm/scrollbar.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c index a1be6e34f..07fee3891 100644 --- a/app/xterm/scrollbar.c +++ b/app/xterm/scrollbar.c @@ -1,7 +1,7 @@ -/* $XTermId: scrollbar.c,v 1.193 2012/09/28 21:04:50 tom Exp $ */ +/* $XTermId: scrollbar.c,v 1.196 2013/02/26 23:36:05 tom Exp $ */ /* - * Copyright 2000-2011,2012 by Thomas E. Dickey + * Copyright 2000-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -697,10 +697,12 @@ AmountToScroll(Widget w, String * params, Cardinal nparams) static void AlternateScroll(Widget w, long amount) { - XtermWidget xw = (XtermWidget) w; - TScreen *screen = TScreenOf(xw); + XtermWidget xw; + TScreen *screen; - if (screen->alternateScroll && screen->whichBuf) { + if ((xw = getXtermWidget(w)) != 0 && + (screen = TScreenOf(xw)) != 0 && + screen->alternateScroll && screen->whichBuf) { ANSI reply; amount /= FontHeight(screen);