[Rcpp-commits] r2865 - pkg/Rcpp/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 13 20:24:38 CET 2011


Author: dmbates
Date: 2011-01-13 20:24:38 +0100 (Thu, 13 Jan 2011)
New Revision: 2865

Modified:
   pkg/Rcpp/src/Reference.cpp
Log:
Protect the value being set in Reference::FieldProxy::set


Modified: pkg/Rcpp/src/Reference.cpp
===================================================================
--- pkg/Rcpp/src/Reference.cpp	2011-01-12 20:29:16 UTC (rev 2864)
+++ pkg/Rcpp/src/Reference.cpp	2011-01-13 19:24:38 UTC (rev 2865)
@@ -90,7 +90,7 @@
     }
     
     void Reference::FieldProxy::set( SEXP x) const {
-    	// TODO: set the field
+		PROTECT(x);
         SEXP call = PROTECT( Rf_lang4( 
             Rf_install( "$<-"), 
             const_cast<Reference&>(parent).asSexp(), 
@@ -98,7 +98,7 @@
             x
             ) ) ;
         const_cast<Reference&>(parent).setSEXP( Rf_eval( call, R_GlobalEnv ) );	
-        UNPROTECT(1) ;
+        UNPROTECT(2) ;
     }
 
     Reference::FieldProxy Reference::field( const std::string& name) const {



More information about the Rcpp-commits mailing list