Repository: alacritty/alacritty
File: alacritty/src/event.rs (Rust)

Code before:
                    payload: EventType::ConfigReload(path), ..
                }) => {
                    // Clear config logs from message bar for all terminals.
                    for window_context in self.windows.values_mut() {
                        if !window_context.message_buffer.is_empty() {
                            window_context.message_buffer.remove_target(LOG_TARGET_CONFIG);
                            window_context.display.pending_update.dirty = true;
                        }
                    }

                    // Load config and update each terminal.
                    if let Ok(config) = config::reload(&path, &self.cli_options) {
                        let old_config = mem::replace(&mut self.config, config);

                        for window_context in self.windows.values_mut() {
                            window_context.update_config(&old_config, &self.config);
                        }
                    }
                },
                // Create a new terminal window.
                GlutinEvent::UserEvent(Event {
                    payload: EventType::CreateWindow(options), ..
                }) => {
                    // XXX Ensure that no context is current when creating a new window, otherwise
                    // it may lock the current context when asking e.g. EGL on Wayland to create
                    // new context.
                    for window_context in self.windows.values_mut() {
                        window_context.display.window.make_not_current();
                    }

                    if let Err(err) = self.create_window(event_loop, proxy.clone(), options) {
                        error!("Could not open window: {:?}", err);
                    }
                },
                // Process events affecting all windows.
                GlutinEvent::UserEvent(event @ Event { window_id: None, .. }) => {
                    for window_context in self.windows.values_mut() {
                        window_context.handle_event(
                            event_loop,
                            &proxy,
                            &mut self.config,
                            &mut clipboard,
                            &mut scheduler,
                            event.clone().into(),
                        );
                    }
                },
                // Process window-specific events.
                GlutinEvent::WindowEvent { window_id, .. }
                | GlutinEvent::UserEvent(Event { window_id: Some(window_id), .. })
                | GlutinEvent::RedrawRequested(window_id) => {

Review comment (suggestion):
```suggestion
                    // XXX Ensure that no context is current when creating a new window, otherwise
                    // it may lock the current context when asking e.g. EGL on Wayland to create a
                    // new context.
```

Code after:
                    payload: EventType::ConfigReload(path), ..
                }) => {
                    // Clear config logs from message bar for all terminals.
                    for window_context in self.windows.values_mut() {
                        if !window_context.message_buffer.is_empty() {
                            window_context.message_buffer.remove_target(LOG_TARGET_CONFIG);
                            window_context.display.pending_update.dirty = true;
                        }
                    }

                    // Load config and update each terminal.
                    if let Ok(config) = config::reload(&path, &self.cli_options) {
                        let old_config = mem::replace(&mut self.config, config);

                        for window_context in self.windows.values_mut() {
                            window_context.update_config(&old_config, &self.config);
                        }
                    }
                },
                // Create a new terminal window.
                GlutinEvent::UserEvent(Event {
                    payload: EventType::CreateWindow(options), ..
                }) => {
                    // XXX Ensure that no context is current when creating a new window, otherwise
                    // it may lock the backing buffer of the surface of current context when asking
                    // e.g. EGL on Wayland to create a new context.
                    for window_context in self.windows.values_mut() {
                        window_context.display.window.make_not_current();
                    }

                    if let Err(err) = self.create_window(event_loop, proxy.clone(), options) {
                        error!("Could not open window: {:?}", err);
                    }
                },
                // Process events affecting all windows.
                GlutinEvent::UserEvent(event @ Event { window_id: None, .. }) => {
                    for window_context in self.windows.values_mut() {
                        window_context.handle_event(
                            event_loop,
                            &proxy,
                            &mut self.config,
                            &mut clipboard,
                            &mut scheduler,
                            event.clone().into(),
                        );
                    }
                },
                // Process window-specific events.
                GlutinEvent::WindowEvent { window_id, .. }
                | GlutinEvent::UserEvent(Event { window_id: Some(window_id), .. })
                | GlutinEvent::RedrawRequested(window_id) => {