diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 8b0b404d1dffbf8a27de1f29437ce9cc2ba63f0f..e6c3e3b8deea9b82514b5ac932c4f204fa081e14 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -958,6 +958,14 @@ impl App { cx.window_update_stack.pop(); window.root.replace(root_view.into()); window.defer(cx, |window: &mut Window, cx| window.appearance_changed(cx)); + + // allow a window to draw at least once before returning + // this didn't cause any issues on non windows platforms as it seems we always won the race to on_request_frame + // on windows we quite frequently lose the race and return a window that has never rendered, which leads to a crash + // where DispatchTree::root_node_id asserts on empty nodes + let clear = window.draw(cx); + clear.clear(); + cx.window_handles.insert(id, window.handle); cx.windows.get_mut(id).unwrap().replace(window); Ok(handle)