Emit g_autoptr support for types generated for dbus
Currently, the types emitted for gdbus do not have g_autoptr support. This is important for C interop. For example, if I declare this in vala:
[DBus(name="org.freedesktop.foo1")]
public interface Foo.Service {
[CCode(cname="foo_service_new")]
public static Service create() throws Error {
return Bus.get_proxy_sync(...);
}
public abstract void frobnicate() throws Error;
}
And then use it like so in C:
static void
request_frobnicate(GError **error)
{
g_autoptr(FooService) service = NULL;
service = foo_service_new(error);
if (!service) return;
foo_service_frobnicate(service, error);
}
the compiler will complain that the FooService
type isn't set up to use g_autoptr
.
For now, I can work around this by adding this to my C: G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooService, g_object_unref)