Make canvas in WindowBuilder safe (#3320)

This commit is contained in:
daxpedda 2023-12-26 01:22:10 +01:00 committed by GitHub
parent 843d7904d6
commit e0fea25b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 214 additions and 169 deletions

View file

@ -34,7 +34,6 @@ use crate::event_loop::EventLoopWindowTarget;
use crate::platform_impl::PlatformCustomCursorBuilder;
use crate::window::CustomCursor;
use crate::window::{Window, WindowBuilder};
use crate::SendSyncWrapper;
use web_sys::HtmlCanvasElement;
@ -105,7 +104,7 @@ pub trait WindowBuilderExtWebSys {
impl WindowBuilderExtWebSys for WindowBuilder {
fn with_canvas(mut self, canvas: Option<HtmlCanvasElement>) -> Self {
self.platform_specific.canvas = SendSyncWrapper(canvas);
self.platform_specific.set_canvas(canvas);
self
}