slint-ui/slint · error

uninitialized platform

Error message

uninitialized platform

What it means

TestingClient.start_if_needed lazily starts the message-loop future that drives the system-test (protobuf/TCP) client; this panic fires when the code tries to start the loop but the platform handle is absent (uninitialized testing backend or already-torn-down platform). It guards the internal invariant that the simulated event loop can only run on top of an initialized platform.

Solutions

  1. Initialize the testing backend (init_no_event_loop or init_integration_test_with_mock_time) before creating TestingClient or starting its message loop
  2. Confirm SLINT_TEST_SERVER is set; the client returns None silently when it is absent, and later uses assume a live platform
  3. Ensure start_if_needed runs only after the platform is set; move the call after init in the test harness
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/backends/testing/systest.rs:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/e7f1f74269d0bd55. Report an issue: GitHub.

Appendix: source

Thrown at internal/backends/testing/systest.rs:36

    state: Rc<IntrospectionState>,
    message_loop_future: std::cell::OnceCell<i_slint_core::future::JoinHandle<()>>,
    server_addr: String,
}

impl TestingClient {
    fn new(state: Rc<IntrospectionState>) -> Option<Rc<Self>> {
        let Ok(server_addr) = std::env::var("SLINT_TEST_SERVER") else {
            return None;
        };

        Some(Rc::new(Self { state, message_loop_future: Default::default(), server_addr }))
    }

    fn start_if_needed(self: &Rc<Self>) {
        let this = self.clone();
        self.message_loop_future.get_or_init(|| {
            i_slint_core::with_global_context(
                || panic!("uninitialized platform"),
                |context| {
                    let this = this.clone();
                    context
                        .spawn_local(async move {
                            message_loop(&this.server_addr, |request| {
                                let this = this.clone();
                                Box::pin(async move { this.handle_request(request).await })
                            })
                            .await;
                        })
                        .unwrap()
                },
            )
            .unwrap()
        });
    }

    async fn handle_request(

View on GitHub (pinned to bb937076de)