[telepathy-glib/master] Install the type infomation earlier

Ross Burton ross at linux.intel.com
Tue Apr 7 11:57:17 PDT 2009


If the type information is installed last then it is possible for dbus-glib to
assert because the dbus-glib containers haven't been initialized yet.  This is
done by installing type info, getting a bus connection, or registering an
object, which isn't always done before object construction.

[Patch modified to install the information just after variable
declarations, rather than before as in Ross's original patch, in order
to be valid C89.]

Signed-off-by: Will Thompson <will.thompson at collabora.co.uk>
---
 tools/glib-ginterface-gen.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
index 3e4195e..f42a85f 100644
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -232,6 +232,15 @@ class Generator(object):
             self.b('  static TpDBusPropertiesMixinIfaceInfo interface =')
             self.b('      { 0, properties, NULL, NULL };')
             self.b('')
+
+
+        self.b('  dbus_g_object_type_install_info (%s%s_get_type (),'
+               % (self.prefix_, node_name_lc))
+        self.b('      &_%s%s_object_info);'
+               % (self.prefix_, node_name_lc))
+        self.b('')
+
+        if properties:
             self.b('  interface.dbus_interface = g_quark_from_static_string '
                    '("%s");' % self.iface_name)
 
@@ -248,10 +257,6 @@ class Generator(object):
 
         for s in base_init_code:
             self.b(s)
-        self.b('  dbus_g_object_type_install_info (%s%s_get_type (),'
-               % (self.prefix_, node_name_lc))
-        self.b('      &_%s%s_object_info);'
-               % (self.prefix_, node_name_lc))
         self.b('}')
 
         self.b('static void')
-- 
1.5.6.5



More information about the telepathy-commits mailing list