Skip to content

Commit b5d305f

Browse files
committed
Protect the newly created XPtr
Thanks @kevinushey
1 parent 876759f commit b5d305f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

inst/include/xml2_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ template <typename T> class XPtr {
1919

2020
XPtr(T* p) {
2121
data_ = R_MakeExternalPtr((void *) p, R_NilValue, R_NilValue);
22+
R_PreserveObject(data_);
2223
}
2324

2425
operator SEXP() const { return data_; }

0 commit comments

Comments
 (0)