mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Use interior mutability for the cache
So we do not need a mutable reference to the Component
This commit is contained in:
parent
e4366efb67
commit
7b8df5ca9d
7 changed files with 33 additions and 30 deletions
|
@ -116,14 +116,14 @@ fn to_eval_value<'a>(
|
|||
|
||||
fn show<'cx>(
|
||||
cx: &mut CallContext<'cx, impl neon::object::This>,
|
||||
mut component: ComponentBox,
|
||||
component: ComponentBox,
|
||||
presistent_context: persistent_context::PersistentContext<'cx>,
|
||||
) -> JsResult<'cx, JsUndefined> {
|
||||
cx.execute_scoped(|cx| {
|
||||
let cx = RefCell::new(cx);
|
||||
let cx_fn = move |callback: &GlobalContextCallback| { callback(&mut *cx.borrow_mut(), &presistent_context) };
|
||||
GLOBAL_CONTEXT.set(&&cx_fn, || {
|
||||
gl::sixtyfps_runtime_run_component_with_gl_renderer(component.borrow_mut());
|
||||
gl::sixtyfps_runtime_run_component_with_gl_renderer(component.borrow());
|
||||
})
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue