Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x11 running two window creation/deletion panics #421

Closed
gui1117 opened this issue Mar 15, 2018 · 5 comments
Closed

x11 running two window creation/deletion panics #421

gui1117 opened this issue Mar 15, 2018 · 5 comments
Labels

Comments

@gui1117
Copy link

gui1117 commented Mar 15, 2018

extern crate winit;

fn main() {
    for _ in 0..2 {
        let mut events_loop = winit::EventsLoop::new();

        let _window = winit::WindowBuilder::new()
            .with_title("A fantastic window!")
            .build(&events_loop)
            .unwrap();

        events_loop.poll_events(|event| {
        });
    }
}

it panics on unwrap None at https://github.com/tomaka/winit/blob/master/src/platform/linux/x11/mod.rs#L360
and then if I fix that it panics on https://github.com/tomaka/winit/blob/master/src/platform/linux/x11/mod.rs#L719

It seems that FocusOut and ConfigureNotify events are sent after window deletion.
A solution would be to return when windows.get_mut(..) returns None on those events. Or maybe on all events.

@gui1117 gui1117 changed the title x11 create running two window creation/deletion panic x11 running two window creation/deletion panic Mar 15, 2018
@gui1117 gui1117 changed the title x11 running two window creation/deletion panic x11 running two window creation/deletion panics Mar 15, 2018
@francesca64
Copy link
Member

This appears to be a duplicate of #414, which means this should be resolved by #416.

(Also, this isn't related to your issue, but as general usage advice, my understanding is that you should only create one EventsLoop and use it for all windows.)

@gui1117
Copy link
Author

gui1117 commented Mar 15, 2018

#416 doesn't solve the issue panic happens at https://github.com/francesca64/winit/blob/x11-drop-window/src/platform/linux/x11/mod.rs#L375

(i agree for one eventsloop)

@francesca64
Copy link
Member

I've updated the code such that all cases should be covered now. Does everything work fine now?

@gui1117
Copy link
Author

gui1117 commented Mar 15, 2018

yes thanks !

@francesca64
Copy link
Member

Fixed via #416

tmfink pushed a commit to tmfink/winit that referenced this issue Jan 5, 2022
… r=pcwalton

Allow clip paths to nest in the canvas API.

Closes rust-windowing#372.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants