Skip to content

Commit

Permalink
fix(core) callback wrapper memory leak
Browse files Browse the repository at this point in the history
When using the CHM closure registry, the Java-side wrapper object was
never removed from the map.
  • Loading branch information
kb-1000 authored and Spasi committed Sep 30, 2023
1 parent e698513 commit 98ef5e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/notes/3.3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This build includes the following changes:

#### Fixes

- Core: Fixed callback wrapper memory leak with the CHM closure registry. (#927)
- tinyfd: The `aDefaultPath` parameter of `tinyfd_selectFolderDialog` is now nullable. (#922)

#### Breaking Changes
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static void free(long functionPointer) {
MemoryManage.DebugAllocator.untrack(functionPointer);
}

FFIClosure closure = CLOSURE_REGISTRY.get(functionPointer);
FFIClosure closure = CLOSURE_REGISTRY.remove(functionPointer);

DeleteGlobalRef(closure.user_data());
ffi_closure_free(closure);
Expand Down Expand Up @@ -234,4 +234,4 @@ public String toString() {
return String.format("%s pointer [0x%X]", getClass().getSimpleName(), address);
}

}
}

0 comments on commit 98ef5e7

Please sign in to comment.