-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Running a Second EventLoop Creates a Segfault #2166
Copy link
Copy link
Labels
H - help wantedSomeone please save usSomeone please save usS - docsAwareness, docs, examples, etc.Awareness, docs, examples, etc.
Description
I created an EventLoop, WinitInputHelper, EventLoop, and Window just fine. The event loop runs as well.
let event_loop = EventLoop::new();
let input = WinitInputHelper::new();
let window = {
let size = LogicalSize::new(self.width as f64, self.height as f64);
WindowBuilder::new()
.with_title("rendering-demo-rs")
.with_inner_size(size)
.with_min_inner_size(size)
.build(&event_loop)
.unwrap()
};
let pixels = {
let window_size = window.inner_size();
let surface_texture =
SurfaceTexture::new(window_size.width, window_size.height, &window);
Pixels::new(self.width, self.height, surface_texture).unwrap()
};
event_loop.run(move |event, _, control_flow| {});However, later in the code, I created another EventLoop forgetting that I didn't have a WIndow attached to it. Using event_loop.run() causes a segmentation fault with no other error. It segfaults when I run either event loop.
let event_loop = EventLoop::new();
self.event_loop.run(move |event, _, control_flow| {});let event_loop = EventLoop::new();
event_loop.run(move |event, _, control_flow| {}); Compiling draw_triangles v0.1.0 (/home/fekwek/Git/rust-pixel-buffer/examples/draw_triangles)
Finished dev [unoptimized + debuginfo] target(s) in 4.26s
Running `target/debug/draw_triangles`
"Rust Pixel Buffer Example"
Segmentation fault (core dumped)It also segfaults when I create another event loop and attach a window to it.
let event_loop = EventLoop::new();
let input = WinitInputHelper::new();
let window = {
let size = LogicalSize::new(self.width as f64, self.height as f64);
WindowBuilder::new()
.with_title("rendering-demo-rs")
.with_inner_size(size)
.with_min_inner_size(size)
.build(&event_loop)
.unwrap()
};
let pixels = {
let window_size = window.inner_size();
let surface_texture =
SurfaceTexture::new(window_size.width, window_size.height, &window);
Pixels::new(self.width, self.height, surface_texture).unwrap()
};
event_loop.run(move |event, _, control_flow| {});(This is my first issue so the quality may be bad)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
H - help wantedSomeone please save usSomeone please save usS - docsAwareness, docs, examples, etc.Awareness, docs, examples, etc.