fix Rc<RefCell<Store>> issues

This commit is contained in:
do butterflies cry? 2026-04-10 10:14:36 +10:00
parent 8aebcdda5a
commit ecd88cd4c1
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -1,6 +1,7 @@
use std::cell::RefCell;
use std::ffi::c_char;
use std::ptr::NonNull;
use std::rc::Rc;
use crate::errors::ErrorContext;
use crate::expr::values::NixString;
@ -74,15 +75,18 @@ impl<'a> RealisedString<'a> {
Ok(Self {
inner: RefCell::new(inner),
path: Self::parse_path(inner.as_ptr(), &state.store_ref().borrow()),
path: Self::parse_path(inner.as_ptr(), state.store_ref().clone()),
children: LazyArray::new(
size,
Box::new(|_| StorePath::fake_path(&state.store_ref().borrow()).unwrap()),
Box::new(|_| StorePath::fake_path(state.store_ref().clone()).unwrap()),
),
})
}
fn parse_path(realised_string: *mut sys::NixRealisedString, store: &Store) -> StorePath {
fn parse_path(
realised_string: *mut sys::NixRealisedString,
store: Rc<RefCell<Store>>,
) -> StorePath {
let buffer_ptr = unsafe { sys::nix_realised_string_get_buffer_start(realised_string) };
let buffer_size = unsafe { sys::nix_realised_string_get_buffer_size(realised_string) };