Subject: bug#62291: 30.0.50; PGTK copy + paste to other app problem

From: Andrew Tropin <[email-masked]>
Date: Fri, 24 Mar 2023 08:31:24 +0400

On 2023-03-24 09:00, Po Lu wrote:

> Andrew Tropin <[email-masked]> writes:
>
>> On 2023-03-23 09:16, Eli Zaretskii wrote:
>>
>>>> Cc: [email-masked]
>>>> From: Andrew Tropin <[email-masked]>
>>>> Date: Thu, 23 Mar 2023 09:18:45 +0400
>>>> 
>>>> (gdb) frame 12
>>>> #12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0xf04510, even7808    in gtkwidget.c
>>>> (gdb) p widget
>>>> $2 = (GtkWidget *) 0xf04510
>>>> (gdb) p Vframe_list
>>>> 'Vframe_list' has unknown type; cast it to its declared type
>>>> (gdb) xcar
>>>> Undefined command: "xcar".  Try "help".
>>>> (gdb) xframe
>>>> Undefined command: "xframe".  Try "help".
>>>
>>> To solve the last two problems, do this:
>>>
>>>   (gdb) source /path/to/emacs/src/.gdbinit
>>>
>>> These are commands we define in .gdbinit which comes with Emacs.
>>
>> Thank you very much. I updated my debugging setup and will write down a
>> note for future readers of this thread:
>>
>> Downloaded latest emacs source code.
>>
>> guix shell -D emacs-next-pgtk --with-debug-info=glib \ 
>> --with-debug-info=gtk+ --no-grafts -- \
>> ./configure --enable-checking='yes,glyphs' \
>> --enable-check-lisp-object-type --with-pgtk \
>> CFLAGS='-O0 -g3'
>>
>> guix shell -D emacs-next-pgtk --with-debug-info=glib \ 
>> --with-debug-info=gtk+ --no-grafts -- make
>>
>> cd src
>> gdb emacs
>>
>> GNU gdb (GDB) 12.1
>> Copyright (C) 2022 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>> Type "show copying" and "show warranty" for details.
>> This GDB was configured as "x86_64-unknown-linux-gnu".
>> Type "show configuration" for configuration details.
>> For bug reporting instructions, please see:
>> <https://www.gnu.org/software/gdb/bugs/>.
>> Find the GDB manual and other documentation resources online at:
>>     <http://www.gnu.org/software/gdb/documentation/>.
>>
>> For help, type "help".
>> Type "apropos word" to search for commands related to "word"...
>> Reading symbols from emacs...
>> SIGINT is used by the debugger.
>> Are you sure you want to change it? (y or n) [answered Y; input not from terminal]
>> DISPLAY = :0
>> WAYLAND_DISPLAY = wayland-1
>> TERM = xterm-256color
>> Breakpoint 1 at 0x57d3f4: file emacs.c, line 427.
>> (gdb) r -Q
>> Starting program: /home/bob/work/gnu/emacs/src/emacs -Q
>> warning: Unable to find libthread_db matching inferior's thread library, thread debu
>> [New LWP 9978]
>> [New LWP 9979]
>> [New LWP 9980]
>> Gdk-Message: 22:14:56.365: Unable to load sb_v_double_arrow from the cursor theme
>> Gdk-Message: 22:14:56.365: Unable to load sb_h_double_arrow from the cursor theme
>> Gdk-Message: 22:14:56.403: Unable to load hand2 from the cursor theme
>> Gdk-Message: 22:14:56.403: Unable to load sb_h_double_arrow from the cursor theme
>> Gdk-Message: 22:14:56.403: Unable to load sb_v_double_arrow from the cursor theme
>> [New LWP 9981]
>> [LWP 9981 exited]
>> [New LWP 9982]
>> [New LWP 9983]
>> [LWP 9982 exited]
>> [LWP 9983 exited]
>> [New LWP 9984]
>> [New LWP 9985]
>> [LWP 9984 exited]
>> [LWP 9985 exited]
>> [LWP 9979 exited]
>>
>> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
>> 0x00007ffff71b5424 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20w
>> msck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> (gdb) bt
>> #0  0x00007ffff71b5424 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #1  0x00007ffff71bb21b in g_signal_emit_valist () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #2  0x00007ffff71bb722 in g_signal_emit () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #3  0x00007ffff71a7884 in g_object_dispatch_properties_changed () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #4  0x00007ffff71a9834 in g_object_notify_by_pspec () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #5  0x00007ffff79afbcd in gtk_window_focus_in_event (event=<optimized out>, widget=0x1014500) at gtkwindow.c:8503
>> #6  gtk_window_focus_in_event (widget=widget@entry=0x1014500, event=<optimized out>) at gtkwindow.c:8491
>> #7  0x00007ffff79de357 in _gtk_marshal_BOOLEAN__BOXED (closure=0x10aedd0, return_value=0x7fffffffb570, n_param_values=<optimized out>, param_values=0x7fffffffb620, 
>>     invocation_hint=<optimized out>, marshal_data=<optimized out>) at gtkmarshalers.c:83
>> #8  0x00007ffff71a34af in g_closure_invoke () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #9  0x00007ffff71b49e9 in signal_emit_unlocked_R.isra.0 () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #10 0x00007ffff71bad65 in g_signal_emit_valist () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #11 0x00007ffff71bb722 in g_signal_emit () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
>> #12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
>> #13 0x00007ffff798d472 in gtk_widget_event_internal (event=0x7fffe4007b50, widget=0x1014500) at gtkwidget.c:7379
>> #14 0x00007ffff784b37a in gtk_main_do_event (event=0x7fffe4007b50) at gtkmain.c:1861
>> #15 gtk_main_do_event (event=<optimized out>) at gtkmain.c:1691
>> #16 0x00007ffff7efc3c5 in _gdk_event_emit (event=event@entry=0x7fffe4007b50) at gdkevents.c:73
>> #17 0x00007ffff7f59352 in gdk_event_source_dispatch (base=<optimized out>, callback=<optimized out>, data=<optimized out>) at gdkeventsource.c:124
>> #18 0x00007ffff70af4cb in g_main_context_dispatch () from /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libglib-2.0.so.0
>> #19 0x00000000007771e4 in pgtk_read_socket (terminal=0x1079530, hold_quit=0x7fffffffba10) at pgtkterm.c:3840
>> #20 0x000000000059703c in gobble_input () at keyboard.c:7424
>> #21 0x0000000000597580 in handle_async_input () at keyboard.c:7655
>> #22 0x000000000059759f in process_pending_signals () at keyboard.c:7669
>> #23 0x00000000005975df in unblock_input_to (level=0) at keyboard.c:7684
>> #24 0x0000000000597603 in unblock_input () at keyboard.c:7703
>> #25 0x000000000058fe19 in timer_check () at keyboard.c:4749
>> #26 0x000000000058ce8a in readable_events (flags=1) at keyboard.c:3531
>> #27 0x0000000000596f04 in get_input_pending (flags=1) at keyboard.c:7374
>> #28 0x00000000005a0201 in detect_input_pending_run_timers (do_display=true) at keyboard.c:10904
>> #29 0x00000000006de504 in wait_reading_process_output (time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0)
>>     at process.c:5779
>> #30 0x0000000000431ef3 in sit_for (timeout=make_fixnum(30), reading=true, display_option=1) at dispnew.c:6256
>> #31 0x000000000058a731 in read_char (commandflag=1, map=XIL(0x7ffff41b4703), prev_event=XIL(0), used_mouse_menu=0x7fffffffc42f, end_time=0x0) at keyboard.c:2879
>> #32 0x000000000059e2ee in read_key_sequence (keybuf=0x7fffffffc5c0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, 
>> --Type <RET> for more, q to quit, c to continue without paging--c
>>     prevent_redisplay=false) at keyboard.c:10081
>> #33 0x0000000000585bc7 in command_loop_1 () at keyboard.c:1382
>> #34 0x0000000000667131 in internal_condition_case (bfun=0x5857bc <command_loop_1>, handlers=XIL(0x90), hfun=0x584c7f <cmd_error>) at eval.c:1474
>> #35 0x00000000005853cc in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1131
>> #36 0x00000000006663ad in internal_catch (tag=XIL(0xff60), func=0x5853a9 <command_loop_2>, arg=XIL(0x90)) at eval.c:1197
>> #37 0x0000000000585365 in command_loop () at keyboard.c:1109
>> #38 0x000000000058476d in recursive_edit_1 () at keyboard.c:718
>> #39 0x0000000000584974 in Frecursive_edit () at keyboard.c:801
>> #40 0x000000000058034c in main (argc=2, argv=0x7fffffffcb08) at emacs.c:2530
>> (gdb) frame 12
>> #12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
>> 7808    gtkwidget.c: No such file or directory.
>> (gdb) frame 12
>> #12 0x00007ffff798ac04 in gtk_widget_event_internal (widget=widget@entry=0x1014500, event=event@entry=0x7fffe4007b50) at gtkwidget.c:7808
>> 7808    in gtkwidget.c
>> (gdb) p widget
>> $1 = (GtkWidget *) 0x1014500
>> (gdb) p Vframe_list 
>> $2 = XIL(0x7ffff41d3213)
>> (gdb) xcar
>> $3 = XIL(0x107975d)
>> (gdb) xframe
>> $4 = (struct frame *) 0x1079758
>> "*scratch* - GNU Emacs at ixy"
>
> You forgot:
>
>   (gdb) p *$4->output_data.pgtk
>
> Thanks.

Right, completely forgot about this one :)

--8<---------------cut here---------------start------------->8---
(gdb) p *$4->output_data.pgtk
$5 = {
  foreground_color = 0,
  background_color = 16777215,
  toolbar = 0x0,
  last_user_time = 0,
  current_cursor = 0x1232460,
  text_cursor = 0x12a56a0,
  nontext_cursor = 0x1232460,
  modeline_cursor = 0x12a56a0,
  hand_cursor = 0x0,
  hourglass_cursor = 0x12a5760,
  horizontal_drag_cursor = 0x0,
  vertical_drag_cursor = 0x0,
  left_edge_cursor = 0x12a5700,
  top_left_corner_cursor = 0x12a5580,
  top_edge_cursor = 0x12a5860,
  top_right_corner_cursor = 0x1275760,
  right_edge_cursor = 0x12a5800,
  bottom_right_corner_cursor = 0x12a55e0,
  bottom_edge_cursor = 0x12a5460,
  bottom_left_corner_cursor = 0x12a5520,
  current_pointer = 0x0,
  border_pixel = 0,
  border_color_css_provider = 0x19f14a0,
  scrollbar_foreground_css_provider = 0x1275440,
  scrollbar_background_css_provider = 0x1255840,
  hourglass_widget = 0x0,
  cursor_xgcv = {
    foreground = 16777215,
    background = 0
  },
  window_desc = 0,
  parent_desc = 42,
  explicit_parent = 0 '\000',
  icon_bitmap = 0,
  font = 0x13957a8,
  baseline_offset = 0,
  fontset = 2,
  mouse_color = 0,
  cursor_color = 0,
  cursor_foreground_color = 16777215,
  icon_top = 0,
  icon_left = 0,
  vertical_scroll_bar_extra = 0,
  titlebar_height = 0,
  toolbar_height = 0,
  display_info = 0x118ee20,
  zooming = 0,
  in_animation = 0,
  size_hints = {
    min_width = 0,
    min_height = 0,
    max_width = 0,
    max_height = 0,
    base_width = 0,
    base_height = 0,
    width_inc = 0,
    height_inc = 0,
    min_aspect = 0,
    max_aspect = 0,
    win_gravity = 0
  },
  hint_flags = 0,
  preferred_width = 672,
  preferred_height = 612,
  widget = 0x1014540,
  edit_widget = 0x1421130,
  vbox_widget = 0x14201c0,
  hbox_widget = 0x1420320,
  menubar_widget = 0x14541a0,
  toolbar_widget = 0x1422260,
  toolbar_in_hbox = false,
  toolbar_is_packed = true,
  ttip_widget = 0x0,
  ttip_lbl = 0x0,
  ttip_window = 0x0,
  menubar_height = 25,
  toolbar_top_height = 41,
  toolbar_bottom_height = 0,
  toolbar_left_width = 0,
  toolbar_right_width = 0,
  cr_context = 0x1345e00,
  cr_active = 0x1345e00,
  cr_surface_desired_width = 624,
  cr_surface_desired_height = 604,
  cr_surface_visible_bell = 0x0,
  atimer_visible_bell = 0x0,
  has_been_visible = 1,
  black_relief = {
    xgcv = {
      foreground = 7566195,
      background = 7779407
    },
    pixel = 7566195
  },
  white_relief = {
    xgcv = {
      foreground = 15132390,
      background = 7779407
    },
    pixel = 15132390
  },
  relief_background = 12566463,
  relief_background_valid_p = true,
  focus_state = 0,
  watched_scale_factor = 2,
  scale_factor_atimer = 0x1734890
}
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin