Skip to content

g-i: mark GtkSnapshot to_(node|paintable) as nullable

Bilal Elmoussaoui requested to merge bilelmoussaoui/g-i into main

Fixes an upstream issue reported at https://github.com/gtk-rs/gtk4-rs/issues/845

Can be checked with

from gi import require_version
require_version('Gtk', '4.0')
from gi.repository import Gtk, Gio

def on_clicked(button):
    snapshot = Gtk.Snapshot.new()
    node = snapshot.to_node()
    assert(node != None)

def on_activate(app):
    window = Gtk.ApplicationWindow.new(app)
    window.set_title("Test case")

    button = Gtk.Button.new_with_label("Test case")
    button.connect("clicked", on_clicked)
    window.set_child(button)
    window.show()


def main():
    app = Gtk.Application.new("gtk4test.gtk4test", Gio.ApplicationFlags.FLAGS_NONE)
    app.connect("activate", on_activate)
    app.run()

main()

Merge request reports