From: Rico Tzschichholz Date: Sat, 16 Jun 2018 08:36:10 +0000 (+0200) Subject: codegen: Custom abstract methods of GLib.Source are handled differently X-Git-Tag: 0.41.90~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=930ed6e6808a2e5bbe6acee7e6903cecd24c82ac;p=thirdparty%2Fvala.git codegen: Custom abstract methods of GLib.Source are handled differently Regression of 28b4f45b709622e821e86655f245fdcb75d3afaf Fixes https://gitlab.gnome.org/GNOME/vala/issues/641 --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 3d977784d..500d506bc 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -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; diff --git a/tests/Makefile.am b/tests/Makefile.am index 612f9cc31..c202f3015 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 000000000..8ee450f1f --- /dev/null +++ b/tests/objects/gsource.vala @@ -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 (); +}