unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
@ 2021-09-01  7:32 Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-11-15 16:39 ` Yuuki Harano
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-01  7:32 UTC (permalink / raw)
  To: 50322

[-- Attachment #1: Type: text/plain, Size: 3969 bytes --]

When enabling `xterm-mouse-mode` mouse click events can also come from
non-graphical frames. This works fine, when there are only non-
graphical frames, but as soon as there is a graphical frame *and* a
non-graphical frame, mouse events in the non-graphical frame crash
Emacs.

Steps to reproduce:

1. Start Emacs daemon

   $ emacs -Q --fg-daemon --eval '(xterm-mouse-mode t)'

2. Start two frames, one graphical, one non-graphical

   $ emacsclient -c &
   $ emacsclient -c -t

3. Click around in both frames to provoke the crash.

The problem is that `pgtk_mouse_position` calls `gtk_widget_get_window`
even for mouse events that do not come from a GTK frame.

#0  0x00007ffff7b58819 in gtk_widget_get_window () from /nix/store/y3c2q2c3p33qg1lnqpivji842mzd39n4-gtk+3-3.24.27/lib/libgtk-3.so.0
#1  0x00000000005c4d2d in pgtk_mouse_position (fp=0x7fffffff2580, insist=<optimized out>, bar_window=0x7fffffff2588, part=0x7fffffff257c, x=<optimized out>, y=<optimized out>, timestamp=<optimized out>) at pgtkterm.c:3354
#2  0x00000000004e8e00 in kbd_buffer_get_event (kbp=kbp@entry=0x7fffffff25e8, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b, end_time=end_time@entry=0x0) at keyboard.c:4087
#3  0x00000000004e8fce in read_event_from_main_queue (end_time=end_time@entry=0x0, local_getcjmp=local_getcjmp@entry=0x7fffffff28b0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b) at keyboard.c:2180
#4  0x00000000004e9283 in read_decoded_event_from_main_queue (end_time=end_time@entry=0x0, local_getcjmp=local_getcjmp@entry=0x7fffffff28b0, prev_event=prev_event@entry=0x0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b) at keyboard.c:2243
#5  0x00000000004ea4d4 in read_char (commandflag=1, map=map@entry=0x191c1c3, prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b, end_time=end_time@entry=0x0) at keyboard.c:2874
#6  0x00000000004ebb52 in read_key_sequence (keybuf=keybuf@entry=0x7fffffff2c00, prompt=prompt@entry=0x0, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false) at keyboard.c:9575
#7  0x00000000004ec776 in command_loop_1 () at lisp.h:1002
#8  0x0000000000557d93 in internal_condition_case (bfun=bfun@entry=0x4ec514 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x4e244d <cmd_error>) at eval.c:1478
#9  0x00000000004dd815 in command_loop_2 (handlers=handlers@entry=0x90) at keyboard.c:1115
#10 0x000000000055a0e0 in internal_catch (tag=tag@entry=0xe6d0, func=func@entry=0x4dd7fb <command_loop_2>, arg=arg@entry=0x90) at eval.c:1198
#11 0x00000000004dd7d7 in command_loop () at lisp.h:1002
#12 0x00000000004e2063 in recursive_edit_1 () at keyboard.c:720
#13 0x00000000004e237a in Frecursive_edit () at keyboard.c:792
#14 0x00000000004dcee2 in main (argc=5, argv=0x7fffffff2f88) at emacs.c:2325

Full backtrace in attachment gdb.log.

Some stuff shows as `<optimized out>` unfortunately, even though I
configured Emacs with `-Og -ggdb3`. Looks like there are some
optimization options creeping in from elsewhere.

;;===================
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.16.0)
Repository revision: 74d017edb6717ad76d38edc02ad3210d4ad66b96
Repository branch: nixos-21.05
Windowing system distributor 'System Description: NixOS 21.05 (Okapi)

Configured using:
 'configure
 --prefix=/nix/store/p2yxdx48mqgvaflygysqz5b7p7q2bbpw-emacs-pgtkgcc-20210725.0
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-cairo --with-native-compilation --with-pgtk'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM
GTK3 ZLIB

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


[-- Attachment #2: gdb.log --]
[-- Type: text/x-log, Size: 11571 bytes --]

Thread 5 (Thread 0x7fffe2c8c640 (LWP 282960) "dconf worker"):
#0  0x00007ffff5b9b329 in poll () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff70e07ee in g_main_context_iterate.constprop () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#2  0x00007ffff70e090f in g_main_context_iteration () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#3  0x00007fffe2ca456d in dconf_gdbus_worker_thread () from /nix/store/6px5h5v8j2lphnkafk8ysc69xh0s757x-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so
No symbol table info available.
#4  0x00007ffff710a28d in g_thread_proxy () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#5  0x00007ffff5dfde9e in start_thread () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libpthread.so.0
No symbol table info available.
#6  0x00007ffff5ba549f in clone () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.

Thread 4 (Thread 0x7fffe34ac640 (LWP 282959) "gdbus"):
#0  0x00007ffff5b9b329 in poll () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff70e07ee in g_main_context_iterate.constprop () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#2  0x00007ffff70e0b4b in g_main_loop_run () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#3  0x00007ffff7334d56 in gdbus_shared_thread_func () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libgio-2.0.so.0
No symbol table info available.
#4  0x00007ffff710a28d in g_thread_proxy () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#5  0x00007ffff5dfde9e in start_thread () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libpthread.so.0
No symbol table info available.
#6  0x00007ffff5ba549f in clone () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.

Thread 3 (Thread 0x7fffe3cb8640 (LWP 282958) "pool-emacs"):
#0  0x00007ffff5ba0299 in syscall () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff71338c2 in g_cond_wait_until () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#2  0x00007ffff70af621 in g_async_queue_pop_intern_unlocked () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#3  0x00007ffff70afc42 in g_async_queue_timeout_pop () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#4  0x00007ffff710abf9 in g_thread_pool_thread_proxy () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#5  0x00007ffff710a28d in g_thread_proxy () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#6  0x00007ffff5dfde9e in start_thread () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libpthread.so.0
No symbol table info available.
#7  0x00007ffff5ba549f in clone () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.

Thread 2 (Thread 0x7fffe4585640 (LWP 282914) "gmain"):
#0  0x00007ffff5b9b329 in poll () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff70e07ee in g_main_context_iterate.constprop () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#2  0x00007ffff70e090f in g_main_context_iteration () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#3  0x00007ffff70e0961 in glib_worker_main () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#4  0x00007ffff710a28d in g_thread_proxy () from /nix/store/9jvzb0zwl093dwj3i12ls068k4dv911z-glib-2.68.2/lib/libglib-2.0.so.0
No symbol table info available.
#5  0x00007ffff5dfde9e in start_thread () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libpthread.so.0
No symbol table info available.
#6  0x00007ffff5ba549f in clone () from /nix/store/gk42f59363p82rg2wv2mfy71jn5w4q4c-glibc-2.32-48/lib/libc.so.6
No symbol table info available.

Thread 1 (Thread 0x7ffff26f44c0 (LWP 282910) "emacs"):
#0  0x00007ffff7b58811 in gtk_widget_get_window () from /nix/store/y3c2q2c3p33qg1lnqpivji842mzd39n4-gtk+3-3.24.27/lib/libgtk-3.so.0
No symbol table info available.
#1  0x00000000005c4d2d in pgtk_mouse_position (fp=0x7fffffff2580, insist=<optimized out>, bar_window=0x7fffffff2588, part=0x7fffffff257c, x=<optimized out>, y=<optimized out>, timestamp=<optimized out>) at pgtkterm.c:3354
        f1 = 0xbe0ee8
        dpyinfo = <optimized out>
        win_x = 23
        win_y = 431
        seat = <optimized out>
        device = <optimized out>
        mask = 0
        win = <optimized out>
        frame = <optimized out>
        tail = <optimized out>
        gdpy = <optimized out>
#2  0x00000000004e8e00 in kbd_buffer_get_event (kbp=kbp@entry=0x7fffffff25e8, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b, end_time=end_time@entry=0x0) at keyboard.c:4087
        bar_window = 0xf59f511204878000
        y = 0x2
        f = 0xdbe2e0
        part = scroll_bar_nowhere
        x = 0x0
        t = 10536992
        obj = <optimized out>
#3  0x00000000004e8fce in read_event_from_main_queue (end_time=end_time@entry=0x0, local_getcjmp=local_getcjmp@entry=0x7fffffff28b0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b) at keyboard.c:2180
        c = 0x0
        save_jump = {{
            __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0},
            __mask_was_saved = 0,
            __saved_mask = {
              __val = {0 <repeats 16 times>}
            }
          }}
        kb = 0xb62270
        count = 3
#4  0x00000000004e9283 in read_decoded_event_from_main_queue (end_time=end_time@entry=0x0, local_getcjmp=local_getcjmp@entry=0x7fffffff28b0, prev_event=prev_event@entry=0x0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b) at keyboard.c:2243
        nextevt = <optimized out>
        frame = <optimized out>
        terminal = <optimized out>
        events = {0x610fcc90, 0x138a65a1, 0x0, 0x19222b3, 0x0, 0x1dcd6500, 0xbe0eed, 0xf59f511204878000, 0x12, 0x0, 0x18dbb33, 0x0, 0x1, 0xbe0eed, 0x1, 0x4e4030 <timer_check+84>}
        n = 0
#5  0x00000000004ea4d4 in read_char (commandflag=1, map=map@entry=0x1922233, prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7fffffff2b2b, end_time=end_time@entry=0x0) at keyboard.c:2874
        c = <optimized out>
        jmpcount = 3
        local_getcjmp = {{
            __jmpbuf = {1, -5891606050207377119, 93, 11936368, 12455661, 0, 5891606700418062625, -5891607200639952607},
            __mask_was_saved = 0,
            __saved_mask = {
              __val = {1118, 11838781, 5537219, 34128, 140737488300400, 2, 0, 10615312, 5599801, 279, 3, 0, 140737250702248, 140737257185451, 5536066, 140737257185435}
            }
          }}
        save_jump = {{
            __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0},
            __mask_was_saved = 0,
            __saved_mask = {
              __val = {0 <repeats 16 times>}
            }
          }}
        tem = <optimized out>
        save = <optimized out>
        previous_echo_area_message = 0x0
        also_record = 0x0
        reread = false
        recorded = false
        polling_stopped_here = true
        orig_kboard = 0xb62270
#6  0x00000000004ebb52 in read_key_sequence (keybuf=keybuf@entry=0x7fffffff2c00, prompt=prompt@entry=0x0, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false) at keyboard.c:9575
        interrupted_kboard = 0xb62270
        interrupted_frame = 0xbe0ee8
        key = <optimized out>
        used_mouse_menu = false
        echo_local_start = 0
        last_real_key_start = 0
        keys_local_start = <optimized out>
        new_binding = <optimized out>
        count = 3
        t = 0
        echo_start = 0
        keys_start = 0
        current_binding = 0x1922233
        first_unbound = 31
        mock_input = 0
        used_mouse_menu_history = {false <repeats 30 times>}
        fkey = {
          parent = 0xbbdc93,
          map = 0xbbdc93,
          start = 0,
          end = 0
        }
        keytran = {
          parent = 0x7ffff23824cb,
          map = 0x7ffff23824cb,
          start = 0,
          end = 0
        }
        indec = {
          parent = 0xbbdc83,
          map = 0xbbdc83,
          start = 0,
          end = 0
        }
        shift_translated = false
        delayed_switch_frame = 0x0
        original_uppercase = 0x0
        original_uppercase_position = -1
        dummyflag = false
        starting_buffer = 0xb4a538
        fake_prefixed_keys = 0x0
        first_event = 0x0
        second_event = <optimized out>
#7  0x00000000004ec776 in command_loop_1 () at lisp.h:1002
        cmd = <optimized out>
        keybuf = {0x19238b3, 0x16e, 0xf2, 0x8a00, 0xa1fec0 <lispsym+35328>, 0x0, 0x2, 0xfa2, 0xffffffff, 0x547dc3 <set_default_internal+415>, 0x8a00, 0x7fffffff2cb0, 0x2, 0x0, 0xa1fec0 <lispsym+35328>, 0x557239 <do_one_unbind+232>, 0xac7110, 0x3, 0xacaa43, 0x0, 0x0, 0x55874f <unbind_to+114>, 0xa, 0x8a00, 0x0, 0x7ffff1ccc70d, 0x0, 0xf59f511204878000, 0x3, 0x7ffff238920b}
        i = <optimized out>
        prev_modiff = 93
        prev_buffer = 0xb4a538
        already_adjusted = false
#8  0x0000000000557d93 in internal_condition_case (bfun=bfun@entry=0x4ec514 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x4e244d <cmd_error>) at eval.c:1478
        val = 0xe165a0
        c = 0xb61b10
#9  0x00000000004dd815 in command_loop_2 (handlers=handlers@entry=0x90) at keyboard.c:1115
        val = 0xe165a0
#10 0x000000000055a0e0 in internal_catch (tag=tag@entry=0xe6d0, func=func@entry=0x4dd7fb <command_loop_2>, arg=arg@entry=0x90) at eval.c:1198
        val = <optimized out>
        c = 0xb42a00
#11 0x00000000004dd7d7 in command_loop () at lisp.h:1002
No locals.
#12 0x00000000004e2063 in recursive_edit_1 () at keyboard.c:720
        count = 1
        val = <optimized out>
#13 0x00000000004e237a in Frecursive_edit () at keyboard.c:792
        count = 0
        buffer = <optimized out>
#14 0x00000000004dcee2 in main (argc=5, argv=0x7fffffff2f88) at emacs.c:2325
        stack_bottom_variable = 0x756e6547fffffab0
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = <optimized out>
        dump_mode = <optimized out>
        skip_args = 1
        temacs = 0x0
        attempt_load_pdump = <optimized out>
        rlim = {
          rlim_cur = 10022912,
          rlim_max = 18446744073709551615
        }
        lc_all = <optimized out>
        sockfd = -1
        module_assertions = <optimized out>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
  2021-09-01  7:32 bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-15 16:39 ` Yuuki Harano
  2021-11-16 16:15   ` Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Yuuki Harano @ 2021-11-15 16:39 UTC (permalink / raw)
  To: henri; +Cc: 50322

It should be fixed in feature/pgtk.
Please try it!

-- 
Yuuki Harano





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
  2021-11-15 16:39 ` Yuuki Harano
@ 2021-11-16 16:15   ` Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-11-21 15:04     ` Yuuki Harano
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-16 16:15 UTC (permalink / raw)
  To: Yuuki Harano; +Cc: 50322

I confirm that this is fixed now.
Thank you very much!

Kind regards,
Henri

On Tue, 2021-11-16 at 01:39 +0900, Yuuki Harano wrote:
> It should be fixed in feature/pgtk.
> Please try it!
> 
> -- 
> Yuuki Harano







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position
  2021-11-16 16:15   ` Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-21 15:04     ` Yuuki Harano
  0 siblings, 0 replies; 4+ messages in thread
From: Yuuki Harano @ 2021-11-21 15:04 UTC (permalink / raw)
  To: 50322-done






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-21 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01  7:32 bug#50322: 28.0.50; feature/pgtk: segfault in pgtk_mouse_position Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-15 16:39 ` Yuuki Harano
2021-11-16 16:15   ` Henri Menke via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-21 15:04     ` Yuuki Harano

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).