[glib/glib-2-48] codegen: Add g_autoptr support for the shared GInterface



commit ca189aa32138c0127db2f9bd99d28b121393b063
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon May 2 19:22:07 2016 +0100

    codegen: Add g_autoptr support for the shared GInterface
    
    The rest of the generated classes gained g_autoptr support in fd6ca66,
    but this one is still missing. Because whatever_proxy_new_finish() and
    whatever_proxy_new_sync() are declared as returning a Whatever *
    instead of a WhateverProxy *, and the generated method-call stubs
    act on a Whatever *, it's reasonably common to want to declare a
    g_autoptr (Whatever).
    
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Bug: https://bugzilla.gnome.org/review?bug=763379
    Reviewed-by: Colin Walters <walters verbum org>
    (cherry picked from commit cbbcaa4dd70a5b28ea62bf408d4fc3e1e2f7f507)

 gio/gdbus-2.0/codegen/codegen.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 9d1acbd..ac836f9 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -307,6 +307,10 @@ class CodeGenerator:
 
             self.h.write('};\n')
             self.h.write('\n')
+            self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+            self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%s, g_object_unref)\n' % (i.camel_name))
+            self.h.write('#endif\n')
+            self.h.write('\n')
             self.h.write('GType %s_get_type (void) G_GNUC_CONST;\n'%(i.name_lower))
             self.h.write('\n')
             self.h.write('GDBusInterfaceInfo *%s_interface_info (void);\n'%(i.name_lower))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]