Skip to content

Add static bound for add_fd_with_callback #504

@yyy33

Description

@yyy33

Since the callback is leaking into memory, should we add a 'static constraint to it to make sure it's always valid, otherwise a JNIEnv <'local> is captured here, and it compiles. But the JNIEnv is only valid in the scope of the native method on_create

//native jni method
pub fn on_create(mut env: JNIEnv, jactivity: JObject) {
    ThreadLooper::for_thread()
        .unwrap()
        .add_fd_with_callback(fd, FdEvent::INPUT, move || {
            env.call_method(obj, name, sig, args);
        })?;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions