]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Checking for vstore in vala_dbus_register_object. Fixes a crash when you
authorPhilip Van Hoof <philip@codeminded.be>
Thu, 29 Jan 2009 19:35:46 +0000 (19:35 +0000)
committerPhilip Van Hoof <pvanhoof@src.gnome.org>
Thu, 29 Jan 2009 19:35:46 +0000 (19:35 +0000)
2009-01-29  Philip Van Hoof  <philip@codeminded.be>

* gobject/valaccodebasemodule.vala:

Checking for vstore in vala_dbus_register_object. Fixes a crash when
you use conn.register_object with an instance that isn't a DBus one

svn path=/trunk/; revision=2408

ChangeLog
gobject/valaccodebasemodule.vala

index 51d4166c2206bd5036513d317286bf6c8db0fc6d..d423afbcdb25d6f0fdb479fe5fba73d475b4c3fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-29  Philip Van Hoof  <philip@codeminded.be>
+
+       * gobject/valaccodebasemodule.vala:
+
+       Checking for vstore in vala_dbus_register_object. Fixes a crash when
+       you use conn.register_object with an instance that isn't a DBus one
+
 2009-01-29  Jürg Billeter  <j@bitron.ch>
 
        * vala/valapropertyaccessor.vala:
index 7bc14c7c8c5cbf03460ea0cc5b0a7677540e9281..7dbe3f3a67609abec37e1bf0f0e5f684a711c229 100644 (file)
@@ -452,7 +452,18 @@ public class Vala.CCodeBaseModule : CCodeModule {
                        cregister.add_argument (new CCodeIdentifier ("connection"));
                        cregister.add_argument (new CCodeIdentifier ("path"));
                        cregister.add_argument (new CCodeIdentifier ("object"));
-                       block.add_statement (new CCodeExpressionStatement (cregister));
+
+                       var ifblock = new CCodeBlock ();
+                       ifblock.add_statement (new CCodeExpressionStatement (cregister));
+
+                       var elseblock = new CCodeBlock ();
+
+                       var warn = new CCodeFunctionCall (new CCodeIdentifier ("g_warning"));
+                       warn.add_argument (new CCodeConstant ("\"Object does not implement any D-Bus interface\""));
+
+                       elseblock.add_statement (new CCodeExpressionStatement(warn));
+
+                       block.add_statement (new CCodeIfStatement (new CCodeIdentifier ("vtable"), ifblock, elseblock));
 
                        source_type_member_definition.append (cfunc);
                }