{"record":{"id":"d7c109bb9f8bf2cc","repo":"slint-ui/slint","slug":"platform-already-initialized","errorCode":null,"errorMessage":"platform already initialized","messagePattern":"platform already initialized","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/testing/lib.rs","lineNumber":45,"sourceCode":"pub mod systest;\n\n/// Initialize the testing backend without support for event loop.\n/// This means that each test thread can use its own backend, but global functions that needs\n/// an event loop such as `slint::invoke_from_event_loop` or `Timer`s won't work.\n/// Must be called before any call that would otherwise initialize the rendering backend.\n/// Calling it when the rendering backend is already initialized will panic.\n///\n/// Note that for animations and timers, the changes in the system time will be disregarded.\n/// Instead, use [`mock_elapsed_time()`] to advance the simulate (mock) time Slint uses.\npub fn init_no_event_loop() {\n    i_slint_core::platform::set_platform(Box::new(testing_backend::TestingBackend::new(\n        testing_backend::TestingBackendOptions {\n            mock_time: true,\n            threading: false,\n            ..Default::default()\n        },\n    )))\n    .expect(\"platform already initialized\");\n}\n\n/// Initialize the testing backend with support for simple event loop.\n/// This function can only be called once per process, so make sure to use integration\n/// tests with only one `#[test]` function. (Or in a doc test)\n/// Must be called before any call that would otherwise initialize the rendering backend.\n/// Calling it when the rendering backend is already initialized will panic.\n///\n/// Note that for animations and timers, the changes in the system time will be disregarded.\n/// Instead, use [`mock_elapsed_time()`] to advance the simulate (mock) time Slint uses.\npub fn init_integration_test_with_mock_time() {\n    i_slint_core::platform::set_platform(Box::new(testing_backend::TestingBackend::new(\n        testing_backend::TestingBackendOptions {\n            mock_time: true,\n            threading: true,\n            ..Default::default()\n        },\n    )))","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/backends/testing/lib.rs#L27-L63","documentation":"Error \"platform already initialized\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/backends/testing/lib.rs:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Initialize the testing platform only once per process.","Guard initialization with a once flag in test setup."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}