mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
linux: Fix panic missing screen mode for crtc specified mode ID (#9106)
Fix panic caused by missing screen mode for specified crtc mode id #9105 by searching over all crtcs instead of using the first one which may be invalid.
This commit is contained in:
parent
95b311cb90
commit
3bd9d14420
@ -314,8 +314,10 @@ impl Client for X11Client {
|
|||||||
.xcb_connection
|
.xcb_connection
|
||||||
.send_request(&xcb::randr::GetScreenResourcesCurrent { window: x_window });
|
.send_request(&xcb::randr::GetScreenResourcesCurrent { window: x_window });
|
||||||
let screen_resources = self.xcb_connection.wait_for_reply(cookie).expect("TODO");
|
let screen_resources = self.xcb_connection.wait_for_reply(cookie).expect("TODO");
|
||||||
let crtc = screen_resources.crtcs().first().expect("TODO");
|
let mode = screen_resources
|
||||||
|
.crtcs()
|
||||||
|
.iter()
|
||||||
|
.find_map(|crtc| {
|
||||||
let cookie = self.xcb_connection.send_request(&xcb::randr::GetCrtcInfo {
|
let cookie = self.xcb_connection.send_request(&xcb::randr::GetCrtcInfo {
|
||||||
crtc: crtc.to_owned(),
|
crtc: crtc.to_owned(),
|
||||||
config_timestamp: xcb::x::Time::CurrentTime as u32,
|
config_timestamp: xcb::x::Time::CurrentTime as u32,
|
||||||
@ -323,10 +325,8 @@ impl Client for X11Client {
|
|||||||
let crtc_info = self.xcb_connection.wait_for_reply(cookie).expect("TODO");
|
let crtc_info = self.xcb_connection.wait_for_reply(cookie).expect("TODO");
|
||||||
|
|
||||||
let mode_id = crtc_info.mode().resource_id();
|
let mode_id = crtc_info.mode().resource_id();
|
||||||
let mode = screen_resources
|
screen_resources.modes().iter().find(|m| m.id == mode_id)
|
||||||
.modes()
|
})
|
||||||
.iter()
|
|
||||||
.find(|m| m.id == mode_id)
|
|
||||||
.expect("Missing screen mode for crtc specified mode id");
|
.expect("Missing screen mode for crtc specified mode id");
|
||||||
|
|
||||||
let refresh_event_token = self
|
let refresh_event_token = self
|
||||||
|
Loading…
Reference in New Issue
Block a user