mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 14:49:07 -04:00
macOS: Fix crash when reconnecting monitors (#4151)
CFArrayGetValueAtIndex does not return a retained value, so we must retain ourselves.
This commit is contained in:
@@ -246,7 +246,7 @@ impl MonitorHandle {
|
||||
let modes: Vec<_> = (0..array_count)
|
||||
.map(move |i| {
|
||||
let mode = CFArrayGetValueAtIndex(&array, i) as *mut CGDisplayMode;
|
||||
CFRetained::from_raw(NonNull::new(mode).unwrap())
|
||||
CFRetained::retain(NonNull::new(mode).unwrap())
|
||||
})
|
||||
.collect();
|
||||
modes
|
||||
|
||||
Reference in New Issue
Block a user