slint-ui/slint · error

winit touch id out of i32 range

Error message

winit touch id out of i32 range

What it means

Error "winit touch id out of i32 range" thrown in slint-ui/slint.

Source

Thrown at internal/backends/winit/event_loop.rs:474

                            position: self.cursor_pos,
                            button,
                            click_count: 0,
                            touch_finger_id: 0,
                        }
                    }
                };
                window.window().dispatch_event(corelib::platform::WindowEvent::internal(ev));
            }
            WindowEvent::Touch(touch) => {
                let location = touch.location.to_logical(runtime_window.scale_factor() as f64);
                let position = euclid::point2(location.x, location.y);
                // winit types the touch id as u64, but on all platforms except
                // iOS it is in fact a small integer that fits in i32. Only iOS
                // stores a UITouch pointer address in it, which
                // TouchFingerIdAllocator maps to a small id instead.
                #[cfg(not(target_os = "ios"))]
                let finger_id =
                    Some(i32::try_from(touch.id).expect("winit touch id out of i32 range"));
                #[cfg(target_os = "ios")]
                let finger_id = match touch.phase {
                    winit::event::TouchPhase::Started | winit::event::TouchPhase::Moved => {
                        self.touch_finger_ids.id_for(touch.id)
                    }
                    winit::event::TouchPhase::Ended | winit::event::TouchPhase::Cancelled => {
                        self.touch_finger_ids.take(touch.id)
                    }
                };
                if let Some(finger_id) = finger_id {
                    window.window().dispatch_event(corelib::platform::WindowEvent::internal(
                        corelib::platform::InternalEvent::Touch {
                            id: finger_id,
                            position,
                            phase: winit_touch_phase(touch.phase),
                        },
                    ));
                }

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. This indicates a platform reporting an out-of-range touch id; update winit/Slint or report the bug.
  2. Filter touch events with ids outside the i32 range if controlled by the application.

When it happens

Trigger: Thrown at internal/backends/winit/event_loop.rs:474 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/f02c761de2c71f0d. Report an issue: GitHub.