GNU bug report logs - #55970
29.0.50; Emacs crashes when dragging the scroll bar with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags

Previous Next

Package: emacs;

Reported by: समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com>

Date: Tue, 14 Jun 2022 14:09:02 UTC

Severity: normal

Tags: fixed

Found in version 29.0.50

Fixed in version 29.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55970 in the body.
You can then email your comments to 55970 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 14:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 14 Jun 2022 14:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Emacs crashes when dragging the scroll bar with
 "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Tue, 14 Jun 2022 19:38:32 +0530
[Message part 1 (text/plain, inline)]
I don't know whether these two features are meant to be used together, but
I still felt the need to report a potential bug.

Recipe to reproduce:
1. './configure --with-pgtk
--without-toolkit-scroll-bars --enable-checking=yes,glyphs
--enable-check-lisp-object-type 'CFLAGS=-O0 -g3''
2. emacs -Q
3. Drag the scrollbar or click on the scroll area where the scrollbar is
not present
4. emacs crashes

I have attached the gdb output, if something is missing please tell me.
Thank You.

In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.34,
cairo version 1.17.6)
 of 2022-06-14 built on archlinux
Repository revision: 03124c42019401022e58ca9ebfa9b41735957ffb
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --without-toolkit-scroll-bars
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 'CFLAGS=-O0 -g3''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PGTK PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: hi_IN.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date seq gv
subr-x byte-opt bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 43476 8688)
 (symbols 48 5707 0)
 (strings 32 15948 1629)
 (string-bytes 1 524087)
 (vectors 16 11402)
 (vector-slots 8 169757 11270)
 (floats 8 20 50)
 (intervals 56 202 0)
 (buffers 992 10))
[Message part 2 (text/html, inline)]
[gdb.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 17:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50;
 Emacs crashes when dragging the scroll bar with "--with-pgtk" and
 "--without-toolkit-scroll-bars" configure flags
Date: Tue, 14 Jun 2022 20:44:04 +0300
> From: समीर सिंह Sameer Singh
>  <lumarzeli30 <at> gmail.com>
> Date: Tue, 14 Jun 2022 19:38:32 +0530
> 
> Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:420
> 420     {
> (gdb) bt full
> #0  terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:420
> #1  0x0000555555740e5e in emacs_abort () at sysdep.c:2310
> #2  0x000055555571ba26 in make_lispy_event (event=0x555555e25300 <kbd_buffer+256>) at keyboard.c:6140
>         button = 0
>         start_pos = XIL(0)
>         is_double = false
>         position = XIL(0x5555567fd423)
>         start_pos_ptr = 0x7ffff1e414c0
>         i = -493962752

Please show the result of the following:

  (gdb) frame 2
  (gdb) p *event

(This assumes that "frame 2 gets you to the frame in make_lispy_event
above; if not adjust the frame number accordingly.)

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 17:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Tue, 14 Jun 2022 23:18:42 +0530
[Message part 1 (text/plain, inline)]
This was the output

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6,
backtrace_limit=40) at emacs.c:420
420     {
(gdb) frame 2
#2  0x000055555571ba26 in make_lispy_event (event=0x555555e25300
<kbd_buffer+256>) at keyboard.c:6140
6140              emacs_abort ();
(gdb) p *event
$1 = {
 kind = SCROLL_BAR_CLICK_EVENT,
 part = scroll_bar_handle,
 code = 0,
 modifiers = 0,
 x = make_fixnum(17531),
 y = make_fixnum(1244637),
 timestamp = 0,
 frame_or_window = XIL(0x5555560794a5),
 arg = XIL(0),
 device = XIL(0x30)
}

On Tue, Jun 14, 2022 at 11:14 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: समीर सिंह Sameer Singh
> >  <lumarzeli30 <at> gmail.com>
> > Date: Tue, 14 Jun 2022 19:38:32 +0530
> >
> > Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6,
> backtrace_limit=40) at emacs.c:420
> > 420     {
> > (gdb) bt full
> > #0  terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:420
> > #1  0x0000555555740e5e in emacs_abort () at sysdep.c:2310
> > #2  0x000055555571ba26 in make_lispy_event (event=0x555555e25300
> <kbd_buffer+256>) at keyboard.c:6140
> >         button = 0
> >         start_pos = XIL(0)
> >         is_double = false
> >         position = XIL(0x5555567fd423)
> >         start_pos_ptr = 0x7ffff1e414c0
> >         i = -493962752
>
> Please show the result of the following:
>
>   (gdb) frame 2
>   (gdb) p *event
>
> (This assumes that "frame 2 gets you to the frame in make_lispy_event
> above; if not adjust the frame number accordingly.)
>
> Thanks.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 18:31:02 GMT) Full text and rfc822 format available.

Message #14 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Tue, 14 Jun 2022 21:30:19 +0300
> From: समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com>
> Date: Tue, 14 Jun 2022 23:18:42 +0530
> Cc: 55970 <at> debbugs.gnu.org
> 
> Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:420
> 420     {
> (gdb) frame 2
> #2  0x000055555571ba26 in make_lispy_event (event=0x555555e25300 <kbd_buffer+256>) at
> keyboard.c:6140
> 6140              emacs_abort ();
> (gdb) p *event
> $1 = {
>  kind = SCROLL_BAR_CLICK_EVENT,
>  part = scroll_bar_handle,
>  code = 0,
>  modifiers = 0,
>  x = make_fixnum(17531),
>  y = make_fixnum(1244637),
>  timestamp = 0,
>  frame_or_window = XIL(0x5555560794a5),
>  arg = XIL(0),
>  device = XIL(0x30)
> }

Thanks.  I think the problem is here:

  static void
  pgtk_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part,
			      int portion, int whole, bool horizontal)
  {
    union buffered_input_event inev;

    EVENT_INIT (inev.ie);

    inev.ie.kind = (horizontal
		    ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
		    : SCROLL_BAR_CLICK_EVENT);
    inev.ie.frame_or_window = window;
    inev.ie.arg = Qnil;
    inev.ie.timestamp = 0;
    inev.ie.code = 0;
    inev.ie.part = part;
    inev.ie.x = make_fixnum (portion);
    inev.ie.y = make_fixnum (whole);
    inev.ie.modifiers = 0;

    evq_enqueue (&inev);
  }

This sets the modifiers to zero, which causes the abort.  Instead, I
suggest to do this:

    inev.ie.modifiers =
      part == scroll_bar_end_scroll ? up_modifier : down_modifier;

Can you try this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 18:46:02 GMT) Full text and rfc822 format available.

Message #17 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 00:14:45 +0530
[Message part 1 (text/plain, inline)]
It does not crash now!
Thank you.

On Wed, Jun 15, 2022 at 12:00 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com>
> > Date: Tue, 14 Jun 2022 23:18:42 +0530
> > Cc: 55970 <at> debbugs.gnu.org
> >
> > Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6,
> backtrace_limit=40) at emacs.c:420
> > 420     {
> > (gdb) frame 2
> > #2  0x000055555571ba26 in make_lispy_event (event=0x555555e25300
> <kbd_buffer+256>) at
> > keyboard.c:6140
> > 6140              emacs_abort ();
> > (gdb) p *event
> > $1 = {
> >  kind = SCROLL_BAR_CLICK_EVENT,
> >  part = scroll_bar_handle,
> >  code = 0,
> >  modifiers = 0,
> >  x = make_fixnum(17531),
> >  y = make_fixnum(1244637),
> >  timestamp = 0,
> >  frame_or_window = XIL(0x5555560794a5),
> >  arg = XIL(0),
> >  device = XIL(0x30)
> > }
>
> Thanks.  I think the problem is here:
>
>   static void
>   pgtk_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part
> part,
>                               int portion, int whole, bool horizontal)
>   {
>     union buffered_input_event inev;
>
>     EVENT_INIT (inev.ie);
>
>     inev.ie.kind = (horizontal
>                     ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
>                     : SCROLL_BAR_CLICK_EVENT);
>     inev.ie.frame_or_window = window;
>     inev.ie.arg = Qnil;
>     inev.ie.timestamp = 0;
>     inev.ie.code = 0;
>     inev.ie.part = part;
>     inev.ie.x = make_fixnum (portion);
>     inev.ie.y = make_fixnum (whole);
>     inev.ie.modifiers = 0;
>
>     evq_enqueue (&inev);
>   }
>
> This sets the modifiers to zero, which causes the abort.  Instead, I
> suggest to do this:
>
>     inev.ie.modifiers =
>       part == scroll_bar_end_scroll ? up_modifier : down_modifier;
>
> Can you try this?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Tue, 14 Jun 2022 18:50:01 GMT) Full text and rfc822 format available.

Message #20 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Tue, 14 Jun 2022 21:48:46 +0300
> From: समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com>
> Date: Wed, 15 Jun 2022 00:14:45 +0530
> Cc: 55970 <at> debbugs.gnu.org
> 
> It does not crash now!

Thanks for testing, I will let it to Po Lu to decide whether that's
the proper fix in this case.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 00:58:01 GMT) Full text and rfc822 format available.

Message #23 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Cc: 55970 <at> debbugs.gnu.org
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 08:56:57 +0800
समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com> writes:

> I don't know whether these two features are meant to be used together, but I still felt the need to report a potential bug.
>
> Recipe to reproduce:
> 1. './configure --with-pgtk --without-toolkit-scroll-bars --enable-checking=yes,glyphs --enable-check-lisp-object-type 'CFLAGS=-O0 -g3''
> 2. emacs -Q
> 3. Drag the scrollbar or click on the scroll area where the scrollbar is not present
> 4. emacs crashes
>
> I have attached the gdb output, if something is missing please tell me.
> Thank You.

I thought that was already fixed, in that you cannot use
--without-toolkit-scroll-bars on PGTK, since the code required to
support non-toolkit scroll bar events isn't present.

Is your configure by any chance out-of-date?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 01:00:02 GMT) Full text and rfc822 format available.

Message #26 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55970 <at> debbugs.gnu.org,
 समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 08:59:20 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks for testing, I will let it to Po Lu to decide whether that's
> the proper fix in this case.

Non-toolkit scroll bars use different kinds of events compared to
toolkit scroll bars.  PGTK only implements the latter kind, so turning
toolkit scroll bars off should trigger this piece of configure.ac:

  elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
    AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
  fi

Perhaps Sameer's configure script is out of date and needs to be
regenerated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 02:30:02 GMT) Full text and rfc822 format available.

Message #29 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55970 <at> debbugs.gnu.org, lumarzeli30 <at> gmail.com
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 05:28:57 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: समीर सिंह Sameer Singh
>  <lumarzeli30 <at> gmail.com>,  55970 <at> debbugs.gnu.org
> Date: Wed, 15 Jun 2022 08:59:20 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks for testing, I will let it to Po Lu to decide whether that's
> > the proper fix in this case.
> 
> Non-toolkit scroll bars use different kinds of events compared to
> toolkit scroll bars.  PGTK only implements the latter kind, so turning
> toolkit scroll bars off should trigger this piece of configure.ac:
> 
>   elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
>     AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
>   fi
> 
> Perhaps Sameer's configure script is out of date and needs to be
> regenerated.

OK, but please explain how come the code in pgtk_send_scroll_bar_event
leaves the modifiers unset, and that is still OK, notwithstanding the
code in keyboard.c that expects either up or down modifier for any
mouse click event?  Isn't that a bug regardless?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 03:30:02 GMT) Full text and rfc822 format available.

Message #32 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55970 <at> debbugs.gnu.org, lumarzeli30 <at> gmail.com
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 11:29:23 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> OK, but please explain how come the code in pgtk_send_scroll_bar_event
> leaves the modifiers unset, and that is still OK, notwithstanding the
> code in keyboard.c that expects either up or down modifier for any
> mouse click event?  Isn't that a bug regardless?

The mouse click code that expects an up or down modifier is only used
for scroll bar events when USE_TOOLKIT_SCROLL_BARS isn't defined.  The
code actually used with toolkit scroll bars starts at line 6359 of
keyboard.c.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 08:25:02 GMT) Full text and rfc822 format available.

Message #35 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55970 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 13:53:40 +0530
[Message part 1 (text/plain, inline)]
>
> Non-toolkit scroll bars use different kinds of events compared to
> toolkit scroll bars.  PGTK only implements the latter kind, so turning
> toolkit scroll bars off should trigger this piece of configure.ac:
>
>   elif test "${window_system}" != "x11" && "${window_system}" != "none";
> then
>     AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your
> system)
>   fi
>
> Perhaps Sameer's configure script is out of date and needs to be
> regenerated.
>

I cloned a fresh copy and configured it with the same flags, but still
there was no error,
even though my configure.ac has the same lines.

AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
   [Define to 1 if we should use toolkit scroll bars.])dnl
USE_TOOLKIT_SCROLL_BARS=no
if test "${with_toolkit_scroll_bars}" != "no"; then
  if test "${USE_X_TOOLKIT}" != "none"; then
    if test "${USE_X_TOOLKIT}" = "MOTIF"; then
      AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
      HAVE_XAW3D=no
      USE_TOOLKIT_SCROLL_BARS=yes
    elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID";
then
      AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
      USE_TOOLKIT_SCROLL_BARS=yes
    fi
  elif test "${HAVE_GTK}" = "yes"; then
    AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
    USE_TOOLKIT_SCROLL_BARS=yes
  elif test "${HAVE_NS}" = "yes"; then
    AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
    USE_TOOLKIT_SCROLL_BARS=yes
  elif test "${HAVE_W32}" = "yes"; then
    AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
    USE_TOOLKIT_SCROLL_BARS=yes
  elif test "${HAVE_BE_APP}" = "yes"; then
    AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
    USE_TOOLKIT_SCROLL_BARS=yes
  fi
elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
  AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
fi

On Wed, Jun 15, 2022 at 8:59 AM Po Lu <luangruo <at> yahoo.com> wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > OK, but please explain how come the code in pgtk_send_scroll_bar_event
> > leaves the modifiers unset, and that is still OK, notwithstanding the
> > code in keyboard.c that expects either up or down modifier for any
> > mouse click event?  Isn't that a bug regardless?
>
> The mouse click code that expects an up or down modifier is only used
> for scroll bar events when USE_TOOLKIT_SCROLL_BARS isn't defined.  The
> code actually used with toolkit scroll bars starts at line 6359 of
> keyboard.c.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 12:27:02 GMT) Full text and rfc822 format available.

Message #38 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55970 <at> debbugs.gnu.org, lumarzeli30 <at> gmail.com
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 15:25:27 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 55970 <at> debbugs.gnu.org,  lumarzeli30 <at> gmail.com
> Date: Wed, 15 Jun 2022 11:29:23 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > OK, but please explain how come the code in pgtk_send_scroll_bar_event
> > leaves the modifiers unset, and that is still OK, notwithstanding the
> > code in keyboard.c that expects either up or down modifier for any
> > mouse click event?  Isn't that a bug regardless?
> 
> The mouse click code that expects an up or down modifier is only used
> for scroll bar events when USE_TOOLKIT_SCROLL_BARS isn't defined.  The
> code actually used with toolkit scroll bars starts at line 6359 of
> keyboard.c.

Then how come the code which aborted got executed contrary to what you
say?  And given that it did, would it do any harm to install the fix I
proposed?

More importantly, does it really make sense to "fix" events in
keyboard.c, rather than generate them correctly in low-level
toolkit-specific code to begin with?  I mean this part:

	/* Always treat scroll bar events as clicks.  */
	event->modifiers |= click_modifier;
	event->modifiers &= ~up_modifier;

Why do we override the modifiers of the event, and why in keyboard.c
of all places?  Can we do this cleaner, or at least in
toolkit-specific code?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 13:15:01 GMT) Full text and rfc822 format available.

Message #41 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55970 <at> debbugs.gnu.org, lumarzeli30 <at> gmail.com
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 21:14:16 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Then how come the code which aborted got executed contrary to what you
> say?

Because USE_TOOLKIT_SCROLL_BARS was not defined.  The reporter passed
`--without-toolkit-scroll-bars' to configure, which is not supported on
PGTK.

The configure script is supposed to prohibit that combination of
options, but somehow that did not happen.

> And given that it did, would it do any harm to install the fix I
> proposed?

Yes, since the events generated would also still be broken, but more
subtly.  USE_TOOLKIT_SCROLL_BARS should always be defined on window
systems other than X, since no other window system implements "native"
scroll bars.

> More importantly, does it really make sense to "fix" events in
> keyboard.c, rather than generate them correctly in low-level
> toolkit-specific code to begin with?  I mean this part:
>
> 	/* Always treat scroll bar events as clicks.  */
> 	event->modifiers |= click_modifier;
> 	event->modifiers &= ~up_modifier;
>
> Why do we override the modifiers of the event, and why in keyboard.c
> of all places?  Can we do this cleaner, or at least in
> toolkit-specific code?

I don't really understand that piece of code.  It seems wrong to me,
since toolkit scroll bar events should not have modifiers at all.

But it's probably there for a reason, which I will look into.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 13:51:02 GMT) Full text and rfc822 format available.

Message #44 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55970 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 15:50:43 +0200
>>>>> On Wed, 15 Jun 2022 08:59:20 +0800, Po Lu <luangruo <at> yahoo.com> said:

    Po> Eli Zaretskii <eliz <at> gnu.org> writes:
    >> Thanks for testing, I will let it to Po Lu to decide whether that's
    >> the proper fix in this case.

    Po> Non-toolkit scroll bars use different kinds of events compared to
    Po> toolkit scroll bars.  PGTK only implements the latter kind, so turning
    Po> toolkit scroll bars off should trigger this piece of configure.ac:

    Po>   elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
    Po>     AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
    Po>   fi

    Po> Perhaps Sameer's configure script is out of date and needs to be
    Po> regenerated.

configure is written in sh, not in C, so you need

diff --git a/configure.ac b/configure.ac
index 5b86e90925..c91b7de322 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3436,7 +3436,7 @@ AC_DEFUN
     AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
     USE_TOOLKIT_SCROLL_BARS=yes
   fi
-elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
+elif test "${window_system}" != "x11" && test "${window_system}" != "none"; then
   AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
 fi
 

(or use -a to avoid repeating the 'test')

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Wed, 15 Jun 2022 14:02:02 GMT) Full text and rfc822 format available.

Message #47 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Po Lu <luangruo <at> yahoo.com>, 55970 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Wed, 15 Jun 2022 19:31:02 +0530
[Message part 1 (text/plain, inline)]
configure is written in sh, not in C, so you need

diff --git a/configure.ac b/configure.ac
index 5b86e90925..c91b7de322 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3436,7 +3436,7 @@ AC_DEFUN
     AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
     USE_TOOLKIT_SCROLL_BARS=yes
   fi
-elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
+elif test "${window_system}" != "x11" && test "${window_system}" !=
"none"; then
   AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
 fi


yes, adding "test" here, correctly produces an error.

On Wed, Jun 15, 2022 at 7:20 PM Robert Pluim <rpluim <at> gmail.com> wrote:

> >>>>> On Wed, 15 Jun 2022 08:59:20 +0800, Po Lu <luangruo <at> yahoo.com> said:
>
>     Po> Eli Zaretskii <eliz <at> gnu.org> writes:
>     >> Thanks for testing, I will let it to Po Lu to decide whether that's
>     >> the proper fix in this case.
>
>     Po> Non-toolkit scroll bars use different kinds of events compared to
>     Po> toolkit scroll bars.  PGTK only implements the latter kind, so
> turning
>     Po> toolkit scroll bars off should trigger this piece of configure.ac:
>
>     Po>   elif test "${window_system}" != "x11" && "${window_system}" !=
> "none"; then
>     Po>     AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for
> your system)
>     Po>   fi
>
>     Po> Perhaps Sameer's configure script is out of date and needs to be
>     Po> regenerated.
>
> configure is written in sh, not in C, so you need
>
> diff --git a/configure.ac b/configure.ac
> index 5b86e90925..c91b7de322 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3436,7 +3436,7 @@ AC_DEFUN
>      AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
>      USE_TOOLKIT_SCROLL_BARS=yes
>    fi
> -elif test "${window_system}" != "x11" && "${window_system}" != "none";
> then
> +elif test "${window_system}" != "x11" && test "${window_system}" !=
> "none"; then
>    AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your
> system)
>  fi
>
>
> (or use -a to avoid repeating the 'test')
>
> Robert
> --
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Thu, 16 Jun 2022 00:54:01 GMT) Full text and rfc822 format available.

Message #50 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 55970 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Thu, 16 Jun 2022 08:53:38 +0800
Robert Pluim <rpluim <at> gmail.com> writes:

> configure is written in sh, not in C, so you need
>
> diff --git a/configure.ac b/configure.ac
> index 5b86e90925..c91b7de322 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3436,7 +3436,7 @@ AC_DEFUN
>      AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
>      USE_TOOLKIT_SCROLL_BARS=yes
>    fi
> -elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
> +elif test "${window_system}" != "x11" && test "${window_system}" != "none"; then
>    AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
>  fi
>  
>
> (or use -a to avoid repeating the 'test')
>
> Robert

Ah, right, that should've been obvious.

Feel free to install that change and close this bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55970; Package emacs. (Thu, 16 Jun 2022 07:40:02 GMT) Full text and rfc822 format available.

Message #53 received at 55970 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 55970 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, समीर सिंह Sameer Singh
 <lumarzeli30 <at> gmail.com>
Subject: Re: bug#55970: 29.0.50; Emacs crashes when dragging the scroll bar
 with "--with-pgtk" and "--without-toolkit-scroll-bars" configure flags
Date: Thu, 16 Jun 2022 09:39:13 +0200
tags 55970 fixed
close 55970 29.1
quit

>>>>> On Thu, 16 Jun 2022 08:53:38 +0800, Po Lu <luangruo <at> yahoo.com> said:

    Po> Robert Pluim <rpluim <at> gmail.com> writes:
    >> configure is written in sh, not in C, so you need
    >> 
    >> diff --git a/configure.ac b/configure.ac
    >> index 5b86e90925..c91b7de322 100644
    >> --- a/configure.ac
    >> +++ b/configure.ac
    >> @@ -3436,7 +3436,7 @@ AC_DEFUN
    >> AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
    >> USE_TOOLKIT_SCROLL_BARS=yes
    >> fi
    >> -elif test "${window_system}" != "x11" && "${window_system}" != "none"; then
    >> +elif test "${window_system}" != "x11" && test "${window_system}" != "none"; then
    >> AC_MSG_ERROR(Non-toolkit scroll bars are not implemented for your system)
    >> fi
    >> 
    >> 
    >> (or use -a to avoid repeating the 'test')
    >> 
    >> Robert

    Po> Ah, right, that should've been obvious.

The mix of sh, m4, C, make, awk etc in configure makes such things
decidedly non-obvious: too many language context switches

    Po> Feel free to install that change and close this bug.

Closing.
Committed as 1054d38bc7




Added tag(s) fixed. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 16 Jun 2022 07:40:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 29.1, send any further explanations to 55970 <at> debbugs.gnu.org and समीर सिंह Sameer Singh <lumarzeli30 <at> gmail.com> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 16 Jun 2022 07:40:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Jul 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.