diff --git a/inst/include/cpp11/external_pointer.hpp b/inst/include/cpp11/external_pointer.hpp index 8733b9ad4..070433a33 100644 --- a/inst/include/cpp11/external_pointer.hpp +++ b/inst/include/cpp11/external_pointer.hpp @@ -68,9 +68,15 @@ class external_pointer { data_ = safe[Rf_shallow_duplicate](rhs.data_); } - external_pointer(external_pointer&& rhs) { reset(rhs.release()); } + external_pointer(external_pointer&& rhs) { + data_ = rhs.data_; + rhs.data_ = R_NilValue; + } - external_pointer& operator=(external_pointer&& rhs) noexcept { reset(rhs.release()); } + external_pointer& operator=(external_pointer&& rhs) noexcept { + data_ = rhs.data_; + rhs.data_ = R_NilValue; + } external_pointer& operator=(std::nullptr_t) noexcept { reset(); };