import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
class Widget(Gtk.Widget):
def __init__(self):
super().__init__()
def request_mode(*_):
return Gtk.SizeRequestMode.CONSTANT_SIZE
def measure(*_):
return 0, 0, 0, 0
def allocate(*_):
pass
self.set_layout_manager(Gtk.CustomLayout.new(request_mode, measure, allocate))
class Application(Gtk.Application):
def do_activate(self):
window = Gtk.ApplicationWindow(application=self)
window.set_child(Widget())
window.present()
Application(application_id='com.example.CustomLayout').run()
The minimal reproducible example above crashes due to a âSegmentation faultâ (or even an âIllegal instructionâ sometimes) on both GTK 4.8.3 (Debian Stable) and 4.16.12 (Debian Testing). Am I doing something wrong or is this indeed a bug in PyGObject as I think it is?