Merge pull request #6330 from dploeger/issue-6157
fix: Fix sysinfo >=0.29.1 crashing the main view on macOS
This commit is contained in:
		
						commit
						cce48c5030
					
				
							
								
								
									
										9
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										9
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -3371,9 +3371,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "libc" | name = "libc" | ||||||
| version = "0.2.149" | version = "0.2.150" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" | checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "libdbus-sys" | name = "libdbus-sys" | ||||||
| @ -5887,8 +5887,7 @@ dependencies = [ | |||||||
| [[package]] | [[package]] | ||||||
| name = "sysinfo" | name = "sysinfo" | ||||||
| version = "0.29.10" | version = "0.29.10" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "git+https://github.com/GuillaumeGomez/sysinfo#f45dcc6510d48c3a1401c5a33eedccc8899f67b2" | ||||||
| checksum = "0a18d114d420ada3a891e6bc8e96a2023402203296a47cdd65083377dad18ba5" |  | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "cfg-if 1.0.0", |  "cfg-if 1.0.0", | ||||||
|  "core-foundation-sys 0.8.4", |  "core-foundation-sys 0.8.4", | ||||||
| @ -5896,7 +5895,7 @@ dependencies = [ | |||||||
|  "ntapi", |  "ntapi", | ||||||
|  "once_cell", |  "once_cell", | ||||||
|  "rayon", |  "rayon", | ||||||
|  "winapi 0.3.9", |  "windows 0.51.1", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
|  | |||||||
| @ -38,7 +38,8 @@ libc = "0.2" | |||||||
| dlopen = "0.1" | dlopen = "0.1" | ||||||
| toml = "0.7" | toml = "0.7" | ||||||
| uuid = { version = "1.3", features = ["v4"] } | uuid = { version = "1.3", features = ["v4"] } | ||||||
| sysinfo = "0.29" | # crash, versions >= 0.29.1 are affected by #GuillaumeGomez/sysinfo/1052 | ||||||
|  | sysinfo = { git = "https://github.com/rustdesk-org/sysinfo" } | ||||||
| 
 | 
 | ||||||
| [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] | [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] | ||||||
| mac_address = "1.1" | mac_address = "1.1" | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ use hbb_common::{ | |||||||
|         supported_decoding::PreferCodec, video_frame, Chroma, CodecAbility, EncodedVideoFrames, |         supported_decoding::PreferCodec, video_frame, Chroma, CodecAbility, EncodedVideoFrames, | ||||||
|         SupportedDecoding, SupportedEncoding, VideoFrame, |         SupportedDecoding, SupportedEncoding, VideoFrame, | ||||||
|     }, |     }, | ||||||
|     sysinfo::{System, SystemExt}, |     sysinfo::{System}, | ||||||
|     tokio::time::Instant, |     tokio::time::Instant, | ||||||
|     ResultType, |     ResultType, | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -877,7 +877,7 @@ pub fn hostname() -> String { | |||||||
| 
 | 
 | ||||||
| #[inline] | #[inline] | ||||||
| pub fn get_sysinfo() -> serde_json::Value { | pub fn get_sysinfo() -> serde_json::Value { | ||||||
|     use hbb_common::sysinfo::{CpuExt, System, SystemExt}; |     use hbb_common::sysinfo::{System}; | ||||||
|     let system = System::new_all(); |     let system = System::new_all(); | ||||||
|     let memory = system.total_memory(); |     let memory = system.total_memory(); | ||||||
|     let memory = (memory as f64 / 1024. / 1024. / 1024. * 100.).round() / 100.; |     let memory = (memory as f64 / 1024. / 1024. / 1024. * 100.).round() / 100.; | ||||||
| @ -1213,7 +1213,7 @@ pub async fn get_next_nonkeyexchange_msg( | |||||||
| 
 | 
 | ||||||
| #[cfg(not(any(target_os = "android", target_os = "ios")))] | #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||||
| pub fn check_process(arg: &str, same_uid: bool) -> bool { | pub fn check_process(arg: &str, same_uid: bool) -> bool { | ||||||
|     use hbb_common::sysinfo::{ProcessExt, System, SystemExt}; |     use hbb_common::sysinfo::{System}; | ||||||
|     let mut sys = System::new(); |     let mut sys = System::new(); | ||||||
|     sys.refresh_processes(); |     sys.refresh_processes(); | ||||||
|     let mut path = std::env::current_exe().unwrap_or_default(); |     let mut path = std::env::current_exe().unwrap_or_default(); | ||||||
|  | |||||||
| @ -596,7 +596,7 @@ async fn check_pid(postfix: &str) { | |||||||
|         file.read_to_string(&mut content).ok(); |         file.read_to_string(&mut content).ok(); | ||||||
|         let pid = content.parse::<usize>().unwrap_or(0); |         let pid = content.parse::<usize>().unwrap_or(0); | ||||||
|         if pid > 0 { |         if pid > 0 { | ||||||
|             use hbb_common::sysinfo::{ProcessExt, System, SystemExt}; |             use hbb_common::sysinfo::{System}; | ||||||
|             let mut sys = System::new(); |             let mut sys = System::new(); | ||||||
|             sys.refresh_processes(); |             sys.refresh_processes(); | ||||||
|             if let Some(p) = sys.process(pid.into()) { |             if let Some(p) = sys.process(pid.into()) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user