[Vala] Problem with GLib.KeyFile



Hi there,

I try to use GLib.KeyFile to parse a configuration file yet I am experiencing 
problems even if I just return a reference to a KeyFile object (see code and 
output below). What am I doing wrong?

Thanks in advance for your help!

Regards,
Robin

== Minimal code example
class Test {

    private GLib.KeyFile key_file = new GLib.KeyFile();

    public GLib.KeyFile get_key_file() {
        return key_file;
    }

    static int main(string[] args) {
        Test test = new Test();
        test.get_key_file();
        return 0;
    }

}

== Compiler output
$ valac test.vala 
test.vala:6.16-6.23: error: duplicating KeyFile instance, use unowned variable 
or explicitly invoke copy method
        return key_file;
               ^^^^^^^^

** (valac:18290): CRITICAL **: vala_ccode_function_add_assignment: assertion 
`right != NULL' failed
Compilation failed: 1 error(s), 0 warning(s)

Attachment: signature.asc
Description: This is a digitally signed message part.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]