[glib/glib-2-58: 2/3] gdbus-codegen: add autocleanup for FooObject
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-58: 2/3] gdbus-codegen: add autocleanup for FooObject
- Date: Tue, 6 Nov 2018 10:43:55 +0000 (UTC)
commit 1fcdf88c45caf159f0548bcb201903fa87684fff
Author: Will Thompson <will willthompson co uk>
Date: Fri Oct 26 11:16:13 2018 +0100
gdbus-codegen: add autocleanup for FooObject
This is only enabled with `--c-generate-autocleanup all` for the
reasons discussed on https://bugzilla.gnome.org/show_bug.cgi?id=763379.
gio/gdbus-2.0/codegen/codegen.py | 5 +++++
gio/tests/gdbus-test-codegen.c | 2 ++
2 files changed, 7 insertions(+)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 0d95cdcda..d393f65cb 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -433,6 +433,11 @@ class HeaderCodeGenerator:
self.outfile.write('GType %sobject_get_type (void) G_GNUC_CONST;\n'
'\n'
%(self.ns_lower))
+ if self.generate_autocleanup == 'all':
+ self.outfile.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+ self.outfile.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%sObject, g_object_unref)\n' %
(self.namespace))
+ self.outfile.write('#endif\n')
+ self.outfile.write('\n')
for i in self.ifaces:
if i.deprecated:
self.outfile.write('G_GNUC_DEPRECATED ')
diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c
index a51cf1846..918ed784f 100644
--- a/gio/tests/gdbus-test-codegen.c
+++ b/gio/tests/gdbus-test-codegen.c
@@ -2398,6 +2398,7 @@ test_autocleanups (void)
g_autoptr(FooiGenBar) bar = NULL;
g_autoptr(FooiGenBarProxy) bar_proxy = NULL;
g_autoptr(FooiGenBarSkeleton) bar_skeleton = NULL;
+ g_autoptr(FooiGenObject) object = NULL;
g_autoptr(FooiGenObjectProxy) object_proxy = NULL;
g_autoptr(FooiGenObjectSkeleton) object_skeleton = NULL;
g_autoptr(FooiGenObjectManagerClient) object_manager_client = NULL;
@@ -2405,6 +2406,7 @@ test_autocleanups (void)
(void) bar;
(void) bar_proxy;
(void) bar_skeleton;
+ (void) object;
(void) object_proxy;
(void) object_skeleton;
(void) object_manager_client;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]