Fix block_on in iced_wgpu hanging Wasm builds

This commit is contained in:
Héctor Ramón Jiménez 2024-03-07 23:25:24 +01:00
parent 1bb5a1b9a2
commit ecf42b97df
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 53 additions and 30 deletions

View file

@ -97,7 +97,7 @@ where
/// Runs an [`Application`] with an executor, compositor, and the provided
/// settings.
pub fn run<A, E, C>(
pub async fn run<A, E, C>(
settings: Settings<A::Flags>,
compositor_settings: C::Settings,
) -> Result<(), Error>
@ -188,7 +188,7 @@ where
};
}
let compositor = C::new(compositor_settings, window.clone())?;
let compositor = C::new(compositor_settings, window.clone()).await?;
let mut renderer = compositor.create_renderer();
for font in settings.fonts {

View file

@ -12,7 +12,9 @@ use crate::core::widget::operation;
use crate::core::window;
use crate::core::{Point, Size};
use crate::futures::futures::channel::mpsc;
use crate::futures::futures::{task, Future, StreamExt};
use crate::futures::futures::executor;
use crate::futures::futures::task;
use crate::futures::futures::{Future, StreamExt};
use crate::futures::{Executor, Runtime, Subscription};
use crate::graphics::{compositor, Compositor};
use crate::multi_window::window_manager::WindowManager;
@ -183,7 +185,8 @@ where
};
}
let mut compositor = C::new(compositor_settings, main_window.clone())?;
let mut compositor =
executor::block_on(C::new(compositor_settings, main_window.clone()))?;
let mut window_manager = WindowManager::new();
let _ = window_manager.insert(