Picking wrong interface when implementing and calling an interface method
Here is a sample of the issue:
public interface Bar : GLib.Object {
[NoWrapper]
public abstract void do_bar ();
}
public class Test1 : GLib.Object, Bar {
public void do_bar () {
message("test1");
}
}
public class Test2 : GLib.Object, Bar {
private Test1 test1 = new Test1 ();
public void do_bar () {
test1.do_bar ();
}
}
Here is the resulting Test2.do_bar ():
static void
test2_real_do_bar (Bar* base)
{
Test2 * self;
Test1* _tmp0_;
self = (Test2*) base;
_tmp0_ = self->priv->test1;
test2_bar_parent_iface->do_bar ((Bar*) _tmp0_);
}
test2_bar_parent_iface
being test2_bar_parent_iface = g_type_interface_peek_parent (iface);
of the interface init which is not Test1 implementation.
If Test2 doesn't implement Bar, we get the correct code:
void
test2_do_bar (Test2* self)
{
Test1* _tmp0_;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->test1;
BAR_GET_INTERFACE ((Bar*) _tmp0_)->do_bar ((Bar*) _tmp0_);
}