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

Fix double free when passing unique_ptr by value #738

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Fix `MoveAdapter` and `UniquePtrAdapter` causing double free on function calls ([pull #738](https://github.com/bytedeco/javacpp/pull/738))
* Fix `Parser` handling of `template` specialization and their `friend` declarations ([pull #733](https://github.com/bytedeco/javacpp/pull/733))
* Improve `Parser` capabilities for `operator` and function templates ([pull #732](https://github.com/bytedeco/javacpp/pull/732))
* Fix `Parser` failing on nested initializer lists and on attributes found inside `enum` declarations
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/bytedeco/javacpp/tools/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver
out.println(" return (typename UNIQUE_PTR_NAMESPACE::remove_const<T>::type*)ptr;");
out.println(" }");
out.println(" operator U&() const { return uniquePtr; }");
out.println(" operator U&&() { return UNIQUE_PTR_NAMESPACE::move(uniquePtr); }");
out.println(" operator U&&() { owner = NULL; return UNIQUE_PTR_NAMESPACE::move(uniquePtr); }");
out.println(" operator U*() { return &uniquePtr; }");
out.println(" T* ptr;");
out.println(" size_t size;");
Expand Down Expand Up @@ -1437,7 +1437,7 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver
out.println(" return ptr;");
out.println(" }");
out.println(" operator const T*() { return ptr; }");
out.println(" operator T&&() { return MOVE_NAMESPACE::move(movedPtr); }");
out.println(" operator T&&() { owner = NULL; return MOVE_NAMESPACE::move(movedPtr); }");
out.println(" T* ptr;");
out.println(" size_t size;");
out.println(" void* owner;");
Expand Down