Skip to content

x11 running two window creation/deletion panics #421

Closed

Description

@gui1117
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.

Activity

  1. changed the title [-]x11 create running two window creation/deletion panic[/-] [+]x11 running two window creation/deletion panic[/+] on Mar 15, 2018
  2. changed the title [-]x11 running two window creation/deletion panic[/-] [+]x11 running two window creation/deletion panics[/+] on Mar 15, 2018
  3. added
    DS - x11
    on Mar 15, 2018
  4. francesca64 commented on Mar 15, 2018

    @francesca64
    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.)

  5. gui1117 commented on Mar 15, 2018

    @gui1117
    Author
  6. francesca64 commented on Mar 15, 2018

    @francesca64
    Member

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

  7. gui1117 commented on Mar 15, 2018

    @gui1117
    Author

    yes thanks !

  8. francesca64 commented on Mar 23, 2018

    @francesca64
    Member

    Fixed via #416

  9. added a commit that references this issue on Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - x11

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions