Skip to content

void-returning non-throwing async method generates broken binding code #1477

@kawadakk

Description

@kawadakk

Given a Vala interface method:

public virtual async void hoge_async() {}

gir generates the following trampoline:

unsafe extern "C" fn hoge_async_trampoline<P: FnOnce(()) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
    let _ = ffi::foo_bar_hoge_finish(_source_object as *mut _, res);
    let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
    let callback: P = callback.into_inner();
    callback(result); // error[E0425]: cannot find value `result` in this scope
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions