]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Custom abstract methods of GLib.Source are handled differently 930ed6e6808a2e5bbe6acee7e6903cecd24c82ac
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 16 Jun 2018 08:36:10 +0000 (10:36 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 16 Jun 2018 08:43:46 +0000 (10:43 +0200)
Regression of 28b4f45b709622e821e86655f245fdcb75d3afaf

Fixes https://gitlab.gnome.org/GNOME/vala/issues/641

codegen/valagtypemodule.vala
tests/Makefile.am
tests/objects/gsource.vala [new file with mode: 0644]

index 3d977784dc2011da31e99f938af51eac1392da26..500d506bc94de618f5158de1b3ea5003d35c4aa6 100644 (file)
@@ -1617,6 +1617,8 @@ public class Vala.GTypeModule : GErrorModule {
 
                push_function (func);
 
+               bool is_gsource = cl.base_class == gsource_type;
+
                if (cl.is_compact) {
                        // Add declaration, since the instance_init function is explicitly called
                        // by the creation methods
@@ -1624,7 +1626,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                        // connect overridden methods
                        foreach (Method m in cl.get_methods ()) {
-                               if (m.base_method == null) {
+                               if (m.base_method == null || is_gsource) {
                                        continue;
                                }
                                var base_type = (ObjectTypeSymbol) m.base_method.parent_symbol;
@@ -1646,7 +1648,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                        // connect overridden properties
                        foreach (Property prop in cl.get_properties ()) {
-                               if (prop.base_property == null) {
+                               if (prop.base_property == null || is_gsource) {
                                        continue;
                                }
                                var base_type = prop.base_property.parent_symbol;
index 612f9cc3152fed86eaf9ba30822d6fbc4dcbd4ec..c202f30157bd48d765bc681e245dc21ef470d9c0 100644 (file)
@@ -234,6 +234,7 @@ TESTS = \
        objects/generics.vala \
        objects/initially-unowned.vala \
        objects/fields.vala \
+       objects/gsource.vala \
        objects/interfaces.vala \
        objects/methods.vala \
        objects/paramspec.vala \
diff --git a/tests/objects/gsource.vala b/tests/objects/gsource.vala
new file mode 100644 (file)
index 0000000..8ee450f
--- /dev/null
@@ -0,0 +1,18 @@
+class FooSource : Source {
+       public override bool prepare (out int timeout) {
+               timeout = 1000;
+               return false;
+       }
+
+       public override bool check () {
+               return false;
+       }
+
+       public override bool dispatch (SourceFunc callback) {
+               return false;
+       }
+}
+
+void main () {
+       var foo = new FooSource ();
+}