Open krlmlr opened 1 year ago
In addition - there's some strange behaviour/errors that I couldn't pin down while moving duplicated external pointers around, e.g.
#include "cpp11.hpp"
using namespace cpp11;
[[cpp11::register]]
void cpp_death() {
external_pointer<int> value_xptr(new int [8]);
external_pointer<int> duplicate_xptr(value_xptr);
value_xptr = std::move(duplicate_xptr);
}
It could be because external_pointer::r_deleter
is called on the old_data
(in external_pointer::reset
) regardless of whether it should be called or not (I would have thought that r_deleter
calls were managed by R when it finalised an EXTPTRSXP
).
Invoking the move constructor of
external_pointer<>
clears attributes on an external pointer object.I would expect the third and fourth output to be identical to the second output. A possible fix is https://github.com/duckdb/duckdb/pull/6526/commits/12f6f10c12edda4d1153777d7a172279be11191c (this project uses a vendored version of cpp11).
Created on 2023-03-02 with reprex v2.0.2