Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Manually implement FFI code for GObject instead of using glib_shared_wrapper! #547
This is basically the workaround for C code passing us floating references that we should not actually own. We try now very hard to not steal them, i.e. the only place where we would steal them now is if a function is returning a
…wrapper! This way we can implement special cases more correctly: - g_value_get_boxed() is invalid for GObjects - Debug impl can print the actual type - Only from_glib_none() will ever steal floating references and e.g. cloning does not, see #545 After this the only places where we would steal floating references from C code would be when explicitly calling from_glib_none() somewhere. That is, when we call a function and get a (transfer none) reference to an object back. (transfer floating) is an alias for this. Especially, cloning and from_glib_borrow() would never steal floating references, and because of this it is very important to only ever use from_glib_borrow() inside callbacks, signal handlers and virtual method trampolines.