fix: Update for more recent Nix API

(cherry picked from commit 55355f03ab86dfa15972681d9a51d333739f6d10)
This commit is contained in:
Robert Hensing 2024-08-29 15:52:16 +02:00
parent cf6bedde14
commit ee1d591e1a
3 changed files with 16 additions and 7 deletions

View file

@ -67,7 +67,7 @@ impl Drop for Value {
fn drop(&mut self) {
unsafe {
// ignoring error because the only failure mode is leaking memory
raw::gc_decref(null_mut(), self.inner.as_ptr());
raw::value_decref(null_mut(), self.inner.as_ptr());
}
}
}
@ -77,7 +77,7 @@ impl Clone for Value {
// this is very unlikely to error, and it is not recoverable
// Maybe try without, and try again with context to report details?
unsafe {
check_call!(raw::gc_incref(&mut Context::new(), self.inner.as_ptr())).unwrap();
check_call!(raw::value_incref(&mut Context::new(), self.inner.as_ptr())).unwrap();
}
// can't return an error here, but we don't want to ignore the error either as it means we could use-after-free
Value { inner: self.inner }