GtkSwitch crashes with GSK_RENDERER=cairo on 4.4.1
A program will crash if it tries to render a GtkSwitch
with the Cairo renderer.
Steps to reproduce
Program code:
#include <gtk/gtk.h>
void activate(GtkApplication *app, gpointer user_data) {
GtkWidget *sw = gtk_switch_new();
GtkWidget *window = gtk_application_window_new(app);
gtk_window_set_child(GTK_WINDOW(window), sw);
gtk_widget_show(window);
}
int main(int argc, char **argv) {
GtkApplication *app = gtk_application_new("com.github.diamondburned.test",
G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
return g_application_run(G_APPLICATION(app), argc, argv);
}
Reproducing steps:
- Build program with
gcc $(pkg-config --cflags gtk4) -o main ./main.c $(pkg-config --libs gtk4)
- Run with
GSK_RENDERER=cairo ./main
Program will crash with Aborted (core dumped)
.
The program will work fine without GSK_RENDERER=cairo
, assuming the renderer that's used by default is the NGL renderer.
Version information
- GTK version 4.4.1
/nix/store/m2jf5kwsg3m8l9kw2vvzsi3qlh76nl4r-gtk4-4.4.1/lib/libgtk-4.so.1
- NixOS 22.05 (Quokka), built with Nixpkgs commit
3fdd780
- Additional information:
- Desktop: GNOME 41.2 on Wayland
- GL renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
The bug was also reproduced on a Debian VM:
- GTK version 4.4.1+ds1-3
- Debian Bookworm
- Additional information:
- Desktop: XFCE on Xorg
- GL renderer: llvmpipe
Warnings
―❤―▶ GSK_RENDERER=cairo ./gotk4/gotktrix/cmd/c/main
(main:2003013): Gdk-WARNING **: 17:30:07.118: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
(main:2003013): Gsk-WARNING **: 17:30:08.299: drawing failure for render node GskTextureNode: invalid matrix (not invertible)
main: cairo-surface.c:2995: _cairo_surface_create_in_error: Assertion `status < CAIRO_STATUS_LAST_STATUS' failed.
Aborted (core dumped)
exit status 134
Backtrace
bt
output with debugging symbols
(gdb) bt
#0 0x00007ffff7526ed8 in cairo_surface_map_to_image () from /nix/store/296xl6s9wnv8kzy5xwy9p17aa3nf06fc-cairo-1.16.0/lib/libcairo.so.2
#1 0x00007ffff7bf799b in gsk_color_matrix_node_draw (node=0x496c90, cr=0x622140) at ../gsk/gskrendernodeimpl.c:3190
#2 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x496c90, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#3 0x00007ffff7bf9697 in gsk_transform_node_draw (node=0x590200, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2856
#4 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x590200, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#5 0x00007ffff7bf485d in gsk_container_node_draw (node=0x62ca00, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2601
#6 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x62ca00, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#7 0x00007ffff7bf9697 in gsk_transform_node_draw (node=0x5901c0, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2856
#8 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x5901c0, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#9 0x00007ffff7bf485d in gsk_container_node_draw (node=0x627f00, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2601
#10 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x627f00, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#11 0x00007ffff7bf53c4 in gsk_rounded_clip_node_draw (node=0x7fffdc38d9e0, cr=0x622140) at ../gsk/gskrendernodeimpl.c:3657
#12 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x7fffdc38d9e0, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#13 0x00007ffff7bf485d in gsk_container_node_draw (node=0x627ea0, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2601
#14 0x00007ffff7bf35d5 in gsk_render_node_draw (node=0x627ea0, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#15 0x00007ffff7bf9697 in gsk_transform_node_draw (node=0x5905c0, cr=0x622140) at ../gsk/gskrendernodeimpl.c:2856
#16 0x00007ffff7bf35d5 in gsk_render_node_draw (node=node@entry=0x5905c0, cr=cr@entry=0x622140) at ../gsk/gskrendernode.c:446
#17 0x00007ffff7bef251 in gsk_cairo_renderer_do_render (renderer=renderer@entry=0x587630, cr=cr@entry=0x622140, root=root@entry=0x5905c0) at ../gsk/gskcairorenderer.c:91
#18 0x00007ffff7bef352 in gsk_cairo_renderer_render (renderer=0x587630, root=0x5905c0, region=<optimized out>) at ../gsk/gskcairorenderer.c:155
#19 0x00007ffff7bf28b9 in gsk_renderer_render (renderer=0x587630, root=0x5905c0, region=<optimized out>) at ../gsk/gskrenderer.c:454
#20 0x00007ffff7a8a33c in gtk_widget_render (widget=<optimized out>, surface=surface@entry=0x58a020, region=region@entry=0x4f3ac0) at ../gtk/gtkwidget.c:11682
#21 0x00007ffff7a916f5 in surface_render (surface=surface@entry=0x58a020, region=region@entry=0x4f3ac0, widget=<optimized out>) at ../gtk/gtkwindow.c:4720
#22 0x00007ffff7b73f44 in _gdk_marshal_BOOLEAN__BOXEDv (closure=closure@entry=0x4b8b00, return_value=return_value@entry=0x7fffffff2960, instance=instance@entry=0x58a020,
args=args@entry=0x7fffffff2a30, marshal_data=marshal_data@entry=0x0, n_params=n_params@entry=1, param_types=0x5b0310) at gdk/gdkmarshalers.c:130
#23 0x00007ffff7269879 in _g_closure_invoke_va (closure=closure@entry=0x4b8b00, return_value=return_value@entry=0x7fffffff2960, instance=instance@entry=0x58a020, args=args@entry=0x7fffffff2a30,
n_params=1, param_types=0x5b0310) at ../gobject/gclosure.c:893
#24 0x00007ffff7281184 in g_signal_emit_valist (instance=0x58a020, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffff2a30) at ../gobject/gsignal.c:3406
#25 0x00007ffff7281fbf in g_signal_emit (instance=instance@entry=0x58a020, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3553
#26 0x00007ffff7b9aa67 in gdk_surface_process_updates_internal (surface=0x58a020) at ../gdk/gdksurface.c:1272
#27 gdk_surface_paint_on_clock (clock=<optimized out>, data=0x58a020) at ../gdk/gdksurface.c:1360
#28 0x00007ffff7269879 in _g_closure_invoke_va (closure=closure@entry=0x587030, return_value=return_value@entry=0x0, instance=instance@entry=0x588190, args=args@entry=0x7fffffff2d30, n_params=0,
param_types=0x0) at ../gobject/gclosure.c:893
#29 0x00007ffff7281d2b in g_signal_emit_valist (instance=0x588190, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffff2d30) at ../gobject/gsignal.c:3406
#30 0x00007ffff7281fbf in g_signal_emit (instance=instance@entry=0x588190, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3553
#31 0x00007ffff7b8d0bf in _gdk_frame_clock_emit_paint (frame_clock=frame_clock@entry=0x588190) at ../gdk/gdkframeclock.c:709
#32 0x00007ffff7b8dad0 in gdk_frame_clock_paint_idle (data=0x588190, data@entry=<error reading variable: value has been optimized out>) at ../gdk/gdkframeclockidle.c:606
#33 0x00007ffff7173594 in g_timeout_dispatch (source=0x5f4260, callback=<optimized out>, user_data=<optimized out>) at ../glib/gmain.c:4933
#34 0x00007ffff7172a0f in g_main_dispatch (context=0x433ec0) at ../glib/gmain.c:3381
#35 g_main_context_dispatch (context=0x433ec0) at ../glib/gmain.c:4099
#36 0x00007ffff7172db8 in g_main_context_iterate (context=context@entry=0x433ec0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4175
#37 0x00007ffff7172e6f in g_main_context_iteration (context=context@entry=0x433ec0, may_block=may_block@entry=1) at ../glib/gmain.c:4240
#38 0x00007ffff738f485 in g_application_run (application=0x4310e0, argc=-53404, argv=<optimized out>) at ../gio/gapplication.c:2569
#39 0x00007ffff6f7e780 in __libc_start_main () from /nix/store/s9qbqh7gzacs7h68b2jfmn9l6q4jwfjz-glibc-2.33-59/lib/libc.so.6
#40 0x000000000040115a in _start () at ../sysdeps/x86_64/start.S:120
Attempting to run gsk_render_node_write_to_file
at the gsk_renderer_render
's root
resulted in a SEGFAULT at gsk_render_node_get_node_type
, so I wasn't able to get one.