Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Transfer ownership of action requests in the C API #429

Merged
merged 3 commits into from
Jun 9, 2024

Conversation

mwcampbell
Copy link
Contributor

This is the simplest way to allow C API users, like GTK, to asynchronously handle arbitrary action requests on another thread.

@@ -1080,9 +1085,9 @@ impl ActivationHandler for FfiActivationHandler {
}

type ActionHandlerCallbackUnwrapped =
extern "C" fn(request: *const action_request, userdata: *mut c_void);
extern "C" fn(request: *mut action_request, userdata: *mut c_void);
pub type ActionHandlerCallback =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should document the ownership transfer here and mention accesskit_action_handler_free.

extern "C" fn(request: *mut action_request, userdata: *mut c_void);

/// Ownership of `request` is transfered to the callback. `request` must
/// be freed using [`accesskit_action_request_free`].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// be freed using [`accesskit_action_request_free`].
/// be freed using `accesskit_action_request_free`.

Remember that these doc comments only end up in the header file and not on docs.rs, so I think the brackets are only adding noise.

@DataTriny DataTriny merged commit d1daa2a into main Jun 9, 2024
10 checks passed
@DataTriny DataTriny deleted the c-transfer-action-request-ownership branch June 9, 2024 18:12
@mwcampbell mwcampbell mentioned this pull request Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants