Skip to content

Webview example crashes on startup (RefCell already borrowed) #2072

@mengh04

Description

@mengh04

Description

The application panics with RefCell already borrowed immediately after launching the webview example. This appears to be a reentrancy issue where gpui::app::AppCell::borrow_mut is called while the cell is already borrowed during the window drawing/initialization process on Windows.

Environment

  • GPUI (Zed): a70e2ad075855582d08d98f (extracted from local cargo path)
  • GPUI Component: v0.5.1 (as per workspace version)
  • Platform: Windows 11 (MSVC)

Steps to Reproduce

  1. Clone the repository.
  2. Navigate to gpui-component\examples\webview.
  3. Run cargo run.
  4. The window opens briefly and immediately crashes.

Screenshots

Image

Expected

The webview window should initialize and render correctly without panicking.

Actual

The program panics with the following error:

thread 'main' panicked at ...\gpui\src\app\async_context.rs:146:28:
RefCell already borrowed
stack backtrace:
...
5: gpui::app::AppCell::borrow_mut
6: gpui::app::async_context::AsyncApp::update::...
7: gpui::window::impl$26::new::closure$3
9: gpui_windows::window::WindowsWindowInner::draw_window
...
20: webview2_com::wait_with_pump

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions