Stack overflow in event handling
andrewhickman opened this issue · 2 comments
andrewhickman commented
Occasionally when I launch my application I get a stack overflow. I'm not sure the best way to debug this but the call stack looks like
GlutinWindow::poll_event()
GlutinWindow::handle_event()
GlutinWindow::poll_event()
GlutinWindow::handle_event()
...
My main loop is currently just
let window: GliumWindow = WindowSettings::new("test", [600, 400])
.exit_on_esc(true)
.opengl(GL)
.build()?;
let g2d = Glium2d::new(OpenGL::V3_2, &win);
while let Some(event) = window.next() {
if let Some(args) = event.render_args() {
render(gs, args);
}
if let Some(args) = event.update_args() {
update(gs, args);
}
}
The overflow seems to always happen before any render or update events are actually passed to the main loop.
bvssvni commented
It's probably caused by 1e4d1ba.
I was aware the overflow could happen in theory, but it passed the tests.
Are you able to fork glutin_window
and print out the events?
andrewhickman commented
by sticking a print at the start of handle_event
I got this:
event: Some(WindowEvent { window_id: WindowId(WindowId(0x14150a)), event: Focused(true) })
event: Some(WindowEvent { window_id: WindowId(WindowId(0x14150a)), event: Resized(600, 400) })
event: Some(WindowEvent { window_id: WindowId(WindowId(0x14150a)), event: Moved(34, 57) })
event: Some(WindowEvent { window_id: WindowId(WindowId(0x14150a)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 28, state
: Released, virtual_keycode: Some(Return), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 1, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 1, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
event: Some(DeviceEvent { device_id: DeviceId(DeviceId), event: Motion { axis: 0, value: -1 } })
... (some more similar events)
thread 'main' has overflowed its stack