Fix crash when application boots from a URL event in macOS
This commit is contained in:
parent
515772c9f8
commit
7c2abc9b8b
1 changed files with 14 additions and 3 deletions
|
|
@ -650,7 +650,7 @@ async fn run_instance<P, C>(
|
||||||
mut runtime: Runtime<P::Executor, Proxy<P::Message>, Action<P::Message>>,
|
mut runtime: Runtime<P::Executor, Proxy<P::Message>, Action<P::Message>>,
|
||||||
mut proxy: Proxy<P::Message>,
|
mut proxy: Proxy<P::Message>,
|
||||||
mut debug: Debug,
|
mut debug: Debug,
|
||||||
mut boot: oneshot::Receiver<Boot<C>>,
|
boot: oneshot::Receiver<Boot<C>>,
|
||||||
mut event_receiver: mpsc::UnboundedReceiver<Event<Action<P::Message>>>,
|
mut event_receiver: mpsc::UnboundedReceiver<Event<Action<P::Message>>>,
|
||||||
mut control_sender: mpsc::UnboundedSender<Control>,
|
mut control_sender: mpsc::UnboundedSender<Control>,
|
||||||
is_daemon: bool,
|
is_daemon: bool,
|
||||||
|
|
@ -665,7 +665,7 @@ async fn run_instance<P, C>(
|
||||||
let Boot {
|
let Boot {
|
||||||
mut compositor,
|
mut compositor,
|
||||||
mut clipboard,
|
mut clipboard,
|
||||||
} = boot.try_recv().ok().flatten().expect("Receive boot");
|
} = boot.await.expect("Receive boot");
|
||||||
|
|
||||||
let mut window_manager = WindowManager::new();
|
let mut window_manager = WindowManager::new();
|
||||||
let mut is_window_opening = !is_daemon;
|
let mut is_window_opening = !is_daemon;
|
||||||
|
|
@ -679,7 +679,18 @@ async fn run_instance<P, C>(
|
||||||
|
|
||||||
debug.startup_finished();
|
debug.startup_finished();
|
||||||
|
|
||||||
while let Some(event) = event_receiver.next().await {
|
loop {
|
||||||
|
// Empty the queue if possible
|
||||||
|
let event = if let Ok(event) = event_receiver.try_next() {
|
||||||
|
event
|
||||||
|
} else {
|
||||||
|
event_receiver.next().await
|
||||||
|
};
|
||||||
|
|
||||||
|
let Some(event) = event else {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::WindowCreated {
|
Event::WindowCreated {
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue