Skip to content

Commit 9e18f44

Browse files
authored
Merge pull request #1231 from RcppCore/bugfix/rcpp-modules-finalize-materialize
force 'finalize' method to be materialized on Modules
2 parents 8a44ae1 + d76a96f commit 9e18f44

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2022-09-23 Kevin Ushey <[email protected]>
2+
3+
* R/Module.R: Force 'finalize' method to be materialized
4+
15
2022-09-20 Dirk Eddelbuettel <[email protected]>
26

37
* DESCRIPTION (Version, Date): Roll minor version

R/Module.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ new_dummyObject <- function(...) # #nocov
131131

132132
# class method for $initialize
133133
cpp_object_initializer <- function(.self, .refClassDef, ..., .object_pointer){
134+
# force finalize method to be materialized
135+
invisible(.self$finalize)
134136
selfEnv <- as.environment(.self)
135137
## generate the C++-side object and store its pointer, etc.
136138
## access the private fields in the fieldPrototypes env.

inst/NEWS.Rd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
\itemize{
88
\item Changes in Rcpp API:
99
\itemize{
10+
\item The 'finalize' method for Rcpp Modules is now eagerly materialized,
11+
fixing an issue where errors can occur when Module finalizers are run.
12+
(Kevin in \ghpr{1231})
1013
\item Unwind protection is enabled by default (Iñaki in \ghpr{1225}).
1114
It can be disabled by defining \code{RCPP_NO_UNWIND_PROTECT} before
1215
including \code{Rcpp.h}. \code{RCPP_USE_UNWIND_PROTECT} is not checked

0 commit comments

Comments
 (0)