macOS: Fix crash when reconnecting monitors (#4151)
CFArrayGetValueAtIndex does not return a retained value, so we must retain ourselves.
This commit is contained in:
parent
46879429ed
commit
8c3e69c08b
1 changed files with 1 additions and 1 deletions
|
|
@ -246,7 +246,7 @@ impl MonitorHandle {
|
||||||
let modes: Vec<_> = (0..array_count)
|
let modes: Vec<_> = (0..array_count)
|
||||||
.map(move |i| {
|
.map(move |i| {
|
||||||
let mode = CFArrayGetValueAtIndex(&array, i) as *mut CGDisplayMode;
|
let mode = CFArrayGetValueAtIndex(&array, i) as *mut CGDisplayMode;
|
||||||
CFRetained::from_raw(NonNull::new(mode).unwrap())
|
CFRetained::retain(NonNull::new(mode).unwrap())
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
modes
|
modes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue