mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
Fix crash when using experimental C++ SkiaRenderer API
Don't box the Result<Renderer, Error>, but box just the renderer. Otherwhise the cast to the renderer pointer is nonsense.
This commit is contained in:
parent
975e82bfbb
commit
d9bc7a08f9
1 changed files with 10 additions and 6 deletions
|
@ -274,12 +274,16 @@ pub unsafe extern "C" fn slint_skia_renderer_new(
|
|||
let window_adapter =
|
||||
core::mem::transmute::<&WindowAdapterRcOpaque, &Rc<dyn WindowAdapter>>(window_adapter);
|
||||
let weak = Rc::downgrade(window_adapter);
|
||||
Box::into_raw(Box::new(SkiaRenderer::new(
|
||||
weak,
|
||||
&*(handle_opaque as *const CppRawHandle),
|
||||
&*(handle_opaque as *const CppRawHandle),
|
||||
PhysicalSize { width: size.width, height: size.height },
|
||||
))) as SkiaRendererOpaque
|
||||
let boxed_renderer: Box<SkiaRenderer> = Box::new(
|
||||
SkiaRenderer::new(
|
||||
weak,
|
||||
&*(handle_opaque as *const CppRawHandle),
|
||||
&*(handle_opaque as *const CppRawHandle),
|
||||
PhysicalSize { width: size.width, height: size.height },
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
Box::into_raw(boxed_renderer) as SkiaRendererOpaque
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue