Crashes after setting child property 'icon-name' on GtkStack then displaying another GtkStack
System information
What is your operating system and version? Arch Linux
What is your version of GJS? gjs 2:1.58.0-1
Bug information
Steps to reproduce
#!/usr/bin/gjs
imports.gi.versions.Gtk = '3.0'
const { Gtk } = imports.gi
Gtk.init(null)
const win = new Gtk.Window()
const stack = new Gtk.Stack()
const stackSwitcher = new Gtk.StackSwitcher({ stack })
const foo = new Gtk.Button({ label: 'foo', tooltip_text: 'Crash me' })
foo.connect('clicked', () => {
const aboutDialog = new Gtk.AboutDialog()
aboutDialog.show()
})
const bar = new Gtk.Label({ label: 'bar' })
stack.add_titled(foo, 'foo', 'foo')
stack.add_titled(bar, 'bar', 'bar')
stack.child_set_property(foo, 'icon-name', 'view-list-symbolic')
stack.child_set_property(bar, 'icon-name', 'user-bookmarks-symbolic')
const vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL })
win.add(vbox)
vbox.pack_start(stackSwitcher, false, true, 0)
vbox.pack_start(stack, false, true, 0)
win.show_all()
win.connect('destroy', Gtk.main_quit)
Gtk.main()
Clicking on "foo" will crash the program.
Current behaviour
(gjs:13880): Gtk-WARNING **: 14:20:50.865: ../gtk/gtk/gtkcontainer.c:1205: container class 'GtkStack' has no child property named 'icon-name'
free(): invalid pointer
Aborted (core dumped)