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

Callback lifetimes #76

Merged
merged 6 commits into from
Oct 25, 2023
Merged

Callback lifetimes #76

merged 6 commits into from
Oct 25, 2023

Conversation

jwharm
Copy link
Owner

@jwharm jwharm commented Oct 25, 2023

Handle the scope attribute of callback parameters to manage memory allocated by Java-GI for the upcall-stub of the callback function. The following scenarios are supported:

  • Callback is deallocated directly after the function call (try-with-resources block)
  • Callback is deallocated when the instance is garbage-collected (for instance methods with callback parameters)
  • Callback is deallocated by a GDestroyNotify closure (notified scope in the gir file)
  • Callback is not deallocated until the application quits

@jwharm jwharm merged commit decf7f3 into main Oct 25, 2023
@jwharm jwharm deleted the callback-scope branch October 25, 2023 14:04
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.

1 participant