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 585158 - Out of scope variable access leads into a gcc error
Out of scope variable access leads into a gcc error
Status: RESOLVED DUPLICATE of bug 554781
Product: vala
Classification: Core
Component: Code Generator
0.7.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-08 15:39 UTC by Eric Alber
Modified: 2009-06-08 15:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Eric Alber 2009-06-08 15:39:30 UTC
I used the GTK+ Sample given on the vala web page.
I just replaced
source.label = "Thank you";
with
button.label = "Thank you";

Here is the code:
using Gtk;

static int main (string[] args) {
    Gtk.init (ref args);

    var window = new Window (WindowType.TOPLEVEL);
    window.title = "First GTK+ Program";
    window.set_default_size (300, 50);
    window.position = WindowPosition.CENTER;
    window.destroy += Gtk.main_quit;

    var button = new Button.with_label ("Click me!");
    button.clicked += (source) => {
        button.label = "Thank you";
    };

    window.add (button);
    window.show_all ();

    Gtk.main ();
    return 0;
}

When compiling this, I get a GCC compilation error telling me that the "button" variable is not accessible.

I don't know if the vala language allows to access to "button" from the inline button.clicked hanlder. If i isn't, I should get a valac error. If it is allowed, the generated code must be wrong.

Regards
Comment 1 Jürg Billeter 2009-06-08 15:50:05 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 554781 ***