Skip to content

Commit 612694e

Browse files
committed
Make ArrowArrayPtr a shared_ptr instead of a unique_ptr
1 parent 4034d48 commit 612694e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

matlab/src/cpp/arrow/matlab/c/proxy/array.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626

2727
namespace arrow::matlab::c::proxy {
2828

29-
Array::Array() : arrowArray{std::make_unique<ArrowArrayPtr>()} {}
29+
struct ArrowArrayDeleter {
30+
void operator()(ArrowArray* array) const {
31+
if (array) {
32+
free(array);
33+
}
34+
}
35+
};
36+
37+
Array::Array() : arrowArray{std::shared_ptr<ArrowArrayPtr>(new ArrowArray(), ArrowArrayDeleter())} {}
3038

3139
Array::~Array() {
3240
if (arrowArray && arrowArray->released != nullptr) {

matlab/src/cpp/arrow/matlab/c/proxy/array.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@
2323

2424
namespace arrow::matlab::c::proxy {
2525

26-
struct ArrowArrayDeleter {
27-
void operator()(ArrowArray* array) const {
28-
if (array) {
29-
free(array);
30-
}
31-
}
32-
};
33-
34-
using ArrowArrayPtr = std::unique_ptr<ArrowArray, arrow::matlab::c::proxy::ArrowArrayDeleter>;
26+
using ArrowArrayPtr = std::shared_ptr<ArrowArray>;
3527

3628

3729
class Array : public libmexclass::proxy::Proxy {

0 commit comments

Comments
 (0)