]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
D-Bus: Require class prerequisite for dbus interfaces
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 2 Jun 2011 18:08:24 +0000 (20:08 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 2 Jun 2011 18:09:05 +0000 (20:09 +0200)
Fixes bug 651715.

codegen/valagdbusservermodule.vala

index 8c1507d8e893c7d1b9f81cef155d835cdf69e9be..6593d08a5e8e6901eaec9bb77fd56dc39b661ae3 100644 (file)
@@ -1225,7 +1225,13 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                alloc_data.add_argument (new CCodeConstant ("3"));
                ccode.add_assignment (new CCodeIdentifier ("data"), alloc_data);
 
-               var ref_object = new CCodeFunctionCall (new CCodeIdentifier (sym.get_ref_function ()));
+               var ref_function = sym.get_ref_function ();
+               if (sym is Interface && ref_function == null) {
+                       Report.error (sym.source_reference, "missing class prerequisite for interface `%s', add GLib.Object to interface declaration if unsure".printf (sym.get_full_name ()));
+                       return;
+               }
+
+               var ref_object = new CCodeFunctionCall (new CCodeIdentifier (ref_function));
                ref_object.add_argument (new CCodeIdentifier ("object"));
                ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("data"), new CCodeConstant ("0")), ref_object);