Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unregister S3 methods explicitly #1001

Merged
merged 4 commits into from
Dec 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# devtools 1.9.1.9000

* Fix longstanding lazy load database corruption issues when reloading packages
which define S3 methods on generics from base or other packages (#1001, @jimhester).

* `document()` now only runs `update_collate()` once.

* Bugfix for `Remotes: ` feature that prevented it from working if devtools was
Expand Down
7 changes: 7 additions & 0 deletions R/install.r
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ install <- function(pkg = ".", reload = TRUE, quick = FALSE, local = TRUE,
pkg <- as.package(pkg)
check_build_tools(pkg)

# Forcing all of the promises for the current namespace now will avoid lazy-load
# errors when the new package is installed overtop the old one.
# https://stat.ethz.ch/pipermail/r-devel/2015-December/072150.html
if (is_loaded(pkg)) {
eapply(ns_env(pkg), force, all.names = TRUE)
}

if (!quiet) {
message("Installing ", pkg$package)
}
Expand Down
7 changes: 3 additions & 4 deletions R/load.r
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@ load_all <- function(pkg = ".", reset = TRUE, recompile = FALSE,

# Reloading devtools is a special case. Normally, objects in the
# namespace become inaccessible if the namespace is unloaded before the
# the object has been accessed. This is kind of a hack - using as.list
# on the namespace accesses each object, making the objects accessible
# later, after the namespace is unloaded.
# object has been accessed. Instead we force the object so they will still be
# accessible.
if (pkg$package == "devtools") {
as.list(ns_env(pkg))
eapply(ns_env(pkg), force, all.names = TRUE)
}

# Check description file is ok
Expand Down
6 changes: 3 additions & 3 deletions R/unload.r
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ unload <- function(pkg = ".") {
# This is a hack to work around unloading devtools itself. The unloading
# process normally makes other devtools functions inaccessible,
# resulting in "Error in unload(pkg) : internal error -3 in R_decompress1".
# If we simply access them here using as.list (without calling them), then
# they will remain available for use later.
# If we simply force them first, then they will remain available for use
# later.
if (pkg$package == "devtools") {
as.list(ns_env(pkg))
eapply(ns_env(pkg), force, all.names = TRUE)
}

# If the package was loaded with devtools, any s4 classes that were created
Expand Down