I think the warnings might be internal to GTK4, and not specific to your code.
Also, these warnings are normally emitted only on development builds of GTK4, and not on release builds.
Refer https://gitlab.gnome.org/GNOME/gtk/-/issues/4563 for more details.