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

Removing factor column from SpatVector causes segfault #969

Closed
brownag opened this issue Jan 10, 2023 · 1 comment
Closed

Removing factor column from SpatVector causes segfault #969

brownag opened this issue Jan 10, 2023 · 1 comment

Comments

@brownag
Copy link
Contributor

brownag commented Jan 10, 2023

R crashes when removing a factor column from a SpatVector.

I get the following with terra 1.6.51 as well as 1.6.47 from CRAN:

library(terra)
#> terra 1.6.51
x1 <- vect(data.frame(a = "A", lon = 1, lat = 2))
x2 <- vect(data.frame(a = as.factor("A"), lon = 1, lat = 2))

# works
x1[["a"]] <- NULL

# crashes R
x2[["a"]] <- NULL

Traceback:

 *** caught segfault ***
address 0xffffffffffffffe0, cause 'memory not mapped'

Traceback:
 1: .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x558247d30c20>,     dll = list(name = "Rcpp", path = "/home/andrew/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/libs/Rcpp.so",         dynamicLookup = TRUE, handle = <pointer: 0x558247dcc150>,         info = <pointer: 0x558246d52df0>), numParameters = -1L),     <pointer: 0x55824b3143f0>, <pointer: 0x558245f103d0>, .pointer,     ...)
 2: x@ptr$remove_column(name)
 3: .local(x, i, ..., value)
 4: `[[<-`(`*tmp*`, "a", value = NULL)
 5: `[[<-`(`*tmp*`, "a", value = NULL)
@rhijmans
Copy link
Member

Ugly! Fixed now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants