GNOME Bugzilla – Bug 575475
Subclasses cannot access overriden member functions
Last modified: 2009-03-29 12:56:25 UTC
Please describe the problem: Updated to vala 0.5.7. Subclasses of GtkWidget and GtkContainer can nolonger access these(not limited within) member functions, if they are overriden in the subclass. gtk_widget_size_allocate gtk_widget_size_request gtk_widget_realize gtk_widget map gtk_widget_expose_event gtk_container_add gtk_container_remove The common characteristics of these member functions are that they have a signal and a corresponding emitter. The signal is decleared as public virtual. The emitter is not declared. Steps to reproduce: using Gtk; public class MenuLabel: Gtk.Container { private Label _label_widget = new Label(""); private Label _accel_widget = new Label(""); public MenuLabel() { _accel_widget.visible = false; _label_widget.visible = false; _label_widget.use_underline = true; _label_widget.ellipsize = Pango.EllipsizeMode.END; this.add(_label_widget); this.add(_accel_widget); } public override void add(Widget child) { if(!(child is Label)) { warning("only GtkLabel is accepted"); return; } } } } Actual results: [rainwoodman@localhost libgnomenu]$ valac -C /tmp/t.vala --pkg gtk+-2.0 t.vala:11.4-11.11: error: Access to private member `Gtk.Container.add' denied this.add(_label_widget); ^^^^^^^^ t.vala:12.4-12.11: error: Access to private member `Gtk.Container.add' denied this.add(_accel_widget); ^^^^^^^^ Compilation failed: 2 error(s), 0 warning(s) Expected results: Does this happen every time? Yes Other information: I am filing this as a blocker because this is rendering Vala 0.5.7 unusable for writing any real widgets since overriding these functions is a must for implementing any useful widgets.
Another case on size_request. using Gtk; public class MenuLabel: Gtk.Container { public MenuLabel() { Requisition r; size_request(out r); } public override void size_request(out Requisition r) { base.size_request(out r); } } }
Created attachment 131140 [details] [review] 0001-Fix-Bug-575475.-Access-the-overriden-Signal-for-memb.patch
this bug is introduced by 3329a9d3092931cd49b0b250e142cfe2063ae470 .
commit 0a2d6e9f056845bca9e21f62f8e75d25f67c29cf Author: Jürg Billeter <j@bitron.ch> Date: Sun Mar 29 14:52:39 2009 +0200 Fix member access when overriding signal class handler Fixes bug 575475.