After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 575475 - Subclasses cannot access overriden member functions
Subclasses cannot access overriden member functions
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.5.x
Other All
: Normal blocker
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks: 571685
 
 
Reported: 2009-03-16 02:29 UTC by rainwoodman
Modified: 2009-03-29 12:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Fix-Bug-575475.-Access-the-overriden-Signal-for-memb.patch (3.07 KB, patch)
2009-03-22 21:05 UTC, rainwoodman
reviewed Details | Review

Description rainwoodman 2009-03-16 02:29:39 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.
Comment 1 rainwoodman 2009-03-16 02:38:58 UTC
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);
        }
    }
}
Comment 2 rainwoodman 2009-03-22 21:05:45 UTC
Created attachment 131140 [details] [review]
0001-Fix-Bug-575475.-Access-the-overriden-Signal-for-memb.patch
Comment 3 rainwoodman 2009-03-22 21:15:06 UTC
this bug is introduced by 3329a9d3092931cd49b0b250e142cfe2063ae470 .
Comment 4 Jürg Billeter 2009-03-29 12:56:25 UTC
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.