Test zz-GdkEvent.t segfaults with perl 5.38.0
Hi, I am trying to install Gtk3 on Ubuntu 22.04 with perl version 5.38.0, when running the test t/zz-GdkEvent.t
I get a segmentation fault:
$ perl -Ilib t/zz-GdkEvent.t
1..146
ok 1 - 'Gtk3::Gdk::Event->new any' isa 'Gtk3::Gdk::Event'
ok 2 - An object of class 'Gtk3::Gdk::EventCrossing' isa 'Gtk3::Gdk::Event'
ok 3
ok 4
ok 5
ok 6
ok 7 - $event->get_screen
ok 8 - $event->get_device
[...]
ok 129 - An object of class 'Gtk3::Gdk::EventTouch' isa 'Gtk3::Gdk::EventTouch'
ok 130
ok 131
ok 132
ok 133
ok 134
ok 135
ok 136
ok 137
ok 138
ok 139
ok 140 - An object of class 'Gtk3::Gdk::EventButton' isa 'Gtk3::Gdk::EventButton'
ok 141 - An object of class 'Gtk3::Gdk::EventButton' isa 'Gtk3::Gdk::EventButton'
Segmentation fault (core dumped)
Running the same test with perl version 5.34.1 gives no segmentation fault.
I think I have reduced the problem down to line 422:
https://gitlab.gnome.org/GNOME/perl-gtk3/-/blob/master/t/zz-GdkEvent.t#L422
So running this minimal program also segfaults:
use v5.38;
use Gtk3;
my $event = Gtk3::Gdk::Event->new ('button-press');
$event->put;
my $i_know_you = 0;
Gtk3::Gdk::Event::handler_set (sub {
return if $i_know_you++;
my ($cb_event, $data) = @_;
Gtk3::main_do_event ($cb_event);
});
$event->put;
Gtk3::main_iteration while Gtk3::events_pending;
Gtk3::Gdk::Event::handler_set (undef);
I ran the program with gdb to get a backtrace:
$ gdb -ex run --args /home/hakon/perlbrew/perls/perl-5.38.0/bin/perl -Ilib debug/event.pl
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 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-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 /home/hakon/perlbrew/perls/perl-5.38.0/bin/perl...
(No debugging symbols found in /home/hakon/perlbrew/perls/perl-5.38.0/bin/perl)
Starting program: /home/hakon/perlbrew/perls/perl-5.38.0/bin/perl -Ilib debug/event.pl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
(process:20025): Gdk-CRITICAL **: 21:39:17.175: gdk_display_put_event: assertion 'GDK_IS_DISPLAY (display)' failed
(process:20025): Gdk-CRITICAL **: 21:39:17.175: gdk_display_put_event: assertion 'GDK_IS_DISPLAY (display)' failed
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6a73034 in g_callable_info_get_closure_native_address () from /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1
(gdb) bt
#0 0x00007ffff6a73034 in g_callable_info_get_closure_native_address () at /usr/lib/x86_64-linux-gnu/libgirepository-1.0.so.1
#1 0x00007ffff6a94fdb in sv_to_interface () at /home/hakon/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/x86_64-linux/auto/Glib/Object/Introspection/Introspection.so
#2 0x00007ffff6a9691e in invoke_c_code.constprop ()
at /home/hakon/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/x86_64-linux/auto/Glib/Object/Introspection/Introspection.so
#3 0x00007ffff6a978aa in XS_Glib__Object__Introspection_invoke ()
at /home/hakon/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/x86_64-linux/auto/Glib/Object/Introspection/Introspection.so
#4 0x00005555556863c4 in Perl_pp_entersub ()
#5 0x000055555567c903 in Perl_runops_standard ()
#6 0x00005555555c1eb7 in perl_run ()
#7 0x000055555559b272 in main ()