Skip to content

Commit 8fb0bb1

Browse files
committed
Define "interesting"
1 parent 497f7ba commit 8fb0bb1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

inst/include/Rcpp/XPtr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ void finalizer_wrapper(SEXP p) {
3737
T* ptr = (T*) R_ExternalPtrAddr(p);
3838
RCPP_DEBUG_3("finalizer_wrapper<%s>(SEXP p = <%p>). ptr = %p", DEMANGLE(T), p, ptr)
3939

40-
// Clear before finalizing to avoid interesting behavior,
40+
// Clear before finalizing to avoid interesting behavior
41+
// like access of freed memory,
4142
// e.g. https://github.com/r-dbi/RPostgres/issues/167
4243
R_ClearExternalPtr(p);
4344

@@ -181,6 +182,7 @@ class XPtr :
181182
// default C++ finalizer is since delete NULL is a no-op).
182183
// This clears the external pointer just before calling the finalizer,
183184
// to avoid interesting behavior with co-dependent finalizers,
185+
// like access of freed memory,
184186
// e.g. https://github.com/r-dbi/RPostgres/issues/167.
185187
finalizer_wrapper<T,Finalizer>(Storage::get__());
186188
}

0 commit comments

Comments
 (0)