Skip to content

Commit 684fa32

Browse files
committed
Merge pull request #461 from bgoodri/fix-issue-458
R/Module.R: avoid calling as.character on a C++Object
2 parents 6294a50 + 527d294 commit 684fa32

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2016-04-11 Ben Goodrich <[email protected]>
2+
* R/Module.R: Avoid calling as.character() on a C++Object to prevent race
3+
14
2016-04-02 Dirk Eddelbuettel <[email protected]>
25

36
* DESCRIPTION: Rolled to minor version 0.12.4.3

R/Module.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ setMethod("initialize", "Module",
111111

112112
.get_Module_Class <- function( x, name, pointer = .getModulePointer(x) ){
113113
value <- .Call( Module__get_class, pointer, name )
114-
value@generator <- get("refClassGenerators",envir=x)[[as.character(value)]]
114+
value@generator <- get("refClassGenerators", envir=x)[[value@.Data]]
115115
value
116116
}
117117

@@ -215,7 +215,7 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
215215
for( i in seq_along(classes) ){
216216
CLASS <- classes[[i]]
217217

218-
clname <- as.character(CLASS)
218+
clname <- CLASS@.Data
219219

220220
fields <- cpp_fields( CLASS, where )
221221
methods <- cpp_refMethods(CLASS, where)
@@ -276,7 +276,7 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
276276

277277
for( i in seq_along(classes) ){
278278
CLASS <- classes[[i]]
279-
clname <- as.character(CLASS)
279+
clname <- CLASS@.Data
280280
demangled_name <- sub( "^Rcpp_", "", clname )
281281
.classes_map[[ CLASS@typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp )
282282

0 commit comments

Comments
 (0)