Skip to content
  • Christophe Fergeau's avatar
    Add workaround for broken IOError.from_errno binding · 78ca8994
    Christophe Fergeau authored
    g_io_error_from_errno returns a GIOErrorEnum, and vala doesn't know
    it should convert it to a GIOError *, which causes compilation issues
    with:
    
    // valac-0.16 --pkg gio-2.0 foo.vala
    // /home/teuf/jhbuild-boxes/sources/gnome-boxes/foo.vala.c: In function ‘test’:
    // /home/teuf/jhbuild-boxes/sources/gnome-boxes/foo.vala.c:26:9: erreur:
    // incompatible types when assigning to type ‘struct GError *’ from type ‘GIOErrorEnum’
    // error: cc exited with status 26
    // Compilation failed: 1 error(s), 0 warning(s)
    
    void test () throws GLib.Error {
        throw GLib.IOError.from_errno(22); // EINVAL
    }
    
    int main () {
        try {
            test ();
        } catch (GLib.Error e) {}
    
        return 0;
    }
    
    This is vala bug 664530. This workaround was suggested by vala
    maintainers as the bug isn't trivial to fix.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679752
    78ca8994