Skip to content

Commit fb6520e

Browse files
committed
Potential fix for #113
1 parent 5be9a70 commit fb6520e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/barrier.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,17 @@ SEXP set_current_error(SEXP cache, SEXP e){
133133

134134
SEXP init_Rcpp_cache(){
135135
SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table
136-
Rcpp::Shield<SEXP> RCPP( Rf_eval(Rf_lang2( getNamespaceSym, Rf_mkString("Rcpp") ), R_GlobalEnv) ) ;
136+
Rcpp::Shield<SEXP> RcppString( Rf_mkString("Rcpp") );
137+
Rcpp::Shield<SEXP> RCPP( Rf_eval(Rf_lang2( getNamespaceSym, RcppString ), R_GlobalEnv) ) ;
137138
Rcpp::Shield<SEXP> cache( Rf_allocVector( VECSXP, RCPP_CACHE_SIZE ) );
138139

139140
// the Rcpp namespace
140141
SET_VECTOR_ELT( cache, 0, RCPP ) ;
141142
set_error_occured( cache, Rf_ScalarLogical(FALSE) ) ; // error occured
142143
set_current_error( cache, R_NilValue ) ; // current error
143144
SET_VECTOR_ELT( cache, 3, R_NilValue ) ; // stack trace
144-
SET_VECTOR_ELT( cache, RCPP_HASH_CACHE_INDEX, Rf_allocVector(INTSXP, RCPP_HASH_CACHE_INITIAL_SIZE) ) ;
145+
Rcpp::Shield<SEXP> tmp( Rf_allocVector(INTSXP, RCPP_HASH_CACHE_INITIAL_SIZE) );
146+
SET_VECTOR_ELT( cache, RCPP_HASH_CACHE_INDEX, tmp );
145147
Rf_defineVar( Rf_install(".rcpp_cache"), cache, RCPP );
146148

147149
return cache ;

0 commit comments

Comments
 (0)