File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2929#ifndef BEGIN_RCPP
3030#define BEGIN_RCPP \
3131 int rcpp_output_type = 0 ; \
32+ int nprot = 0 ; \
3233 (void )rcpp_output_type; \
3334 SEXP rcpp_output_condition = R_NilValue ; \
3435 (void )rcpp_output_condition; \
36+ static SEXP stop_sym = Rf_install(" stop" ); \
3537 try {
3638#endif
3739
4850 catch (Rcpp::exception& __ex__) { \
4951 rcpp_output_type = 2 ; \
5052 rcpp_output_condition = PROTECT (rcpp_exception_to_r_condition (__ex__)) ; \
53+ ++nprot; \
5154 } \
5255 catch ( std::exception& __ex__ ){ \
5356 rcpp_output_type = 2 ; \
5457 rcpp_output_condition = PROTECT (exception_to_r_condition (__ex__)) ; \
58+ ++nprot; \
5559 } \
5660 catch ( ... ){ \
5761 rcpp_output_type = 2 ; \
5862 rcpp_output_condition = PROTECT (string_to_try_error (" c++ exception (unknown reason)" )) ; \
63+ ++nprot; \
5964 } \
6065 if ( rcpp_output_type == 1 ){ \
6166 Rf_onintr () ; \
6267 } \
6368 if ( rcpp_output_type == 2 ){ \
64- SEXP stop_sym = Rf_install ( " stop" ) ; \
6569 SEXP expr = PROTECT ( Rf_lang2 ( stop_sym , rcpp_output_condition ) ) ; \
66- Rf_eval ( expr, R_GlobalEnv ) ; \
70+ ++nprot; \
71+ Rf_eval ( expr, R_BaseEnv ) ; \
6772 } \
6873 if (rcpp_output_type == 3 ) { \
6974 Rcpp::internal::resumeJump (rcpp_output_condition); \
70- }
75+ } \
76+ UNPROTECT (nprot);
7177#endif
7278
7379#ifndef END_RCPP
You can’t perform that action at this time.
0 commit comments