Fix double refs of callback arguments #327
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
java-gi/java-gi!327
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-callback-refs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Callback arguments with transfer-ownership=none are ref-ed by java-gi to prevent a double free. However, the call to
GObject.ref()was executed every time the callback is executed, continously increasing the refcount. As a result, the objects were never disposed.This PR introduces a new method
InstanceCache.refOnce()that uses an internal Set to ensure theref()call only happens once for each object.