{"record":{"id":"4757c0901fcb2711","repo":"slint-ui/slint","slug":"the-event-loop-runs-inside-the-context-that-owns-t","errorCode":null,"errorMessage":"the event loop runs inside the context that owns this platform","messagePattern":"the event loop runs inside the context that owns this platform","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/android-activity/lib.rs","lineNumber":114,"sourceCode":"        app: AndroidApp,\n        listener: impl Fn(&PollEvent<'_>) + 'static,\n    ) -> Self {\n        let mut this = Self::new(app);\n        this.event_listener = Some(Box::new(listener));\n        this\n    }\n}\n\nimpl i_slint_core::platform::Platform for AndroidPlatform {\n    fn create_window_adapter(&self) -> Result<Rc<dyn WindowAdapter>, PlatformError> {\n        Ok(self.window.clone())\n    }\n    fn run_event_loop(&self) -> Result<(), PlatformError> {\n        let ctx = self\n            .context\n            .get()\n            .and_then(|ctx| ctx.upgrade())\n            .expect(\"the event loop runs inside the context that owns this platform\");\n        let vsync = vsync::VsyncDriver::new(self.app.create_waker());\n        loop {\n            let mut timeout = ctx.duration_until_next_timer_update();\n            // While animating, the vsync thread wakes this loop at each display refresh\n            // so rendering tracks the refresh rate instead of a fixed poll timeout.\n            let animating = self.window.window.has_active_animations();\n            vsync.set_animating(animating);\n            if animating && !vsync.is_driving() {\n                // The vsync thread is not driving frames (still starting, or unavailable);\n                // fall back to a periodic wakeup so animations still advance.\n                let frame_duration = Duration::from_millis(10);\n                timeout = Some(timeout.map_or(frame_duration, |x| x.min(frame_duration)));\n            }\n            // `request_redraw()` only raises the flag, so a request issued outside the\n            // poll would otherwise wait here for an unrelated wakeup.\n            if self.window.pending_redraw.get() {\n                timeout = Some(Duration::ZERO);\n            }","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/backends/android-activity/lib.rs#L96-L132","documentation":"Error \"the event loop runs inside the context that owns this platform\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/backends/android-activity/lib.rs:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the event loop from the platform's owning context instead of a custom one.","Follow the Android activity lifecycle expected by the backend."],"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"}