mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
FIXUP: also fix AudioQueue::open_queue
This commit is contained in:
+4
-1
@@ -559,7 +559,10 @@ impl<'a, Channel: AudioFormatNum> AudioQueue<Channel> {
|
||||
Some(device) => Some(CString::new(device).unwrap()),
|
||||
None => None
|
||||
};
|
||||
let device_ptr = device.map_or(ptr::null(), |s| s.as_ptr());
|
||||
// Warning: map_or consumes its argument; `device.map_or()` would therefore consume the
|
||||
// CString and drop it, making device_ptr a dangling pointer! To avoid that we downgrade
|
||||
// device to an Option<&_> first.
|
||||
let device_ptr = device.as_ref().map_or(ptr::null(), |s| s.as_ptr());
|
||||
|
||||
let iscapture_flag = 0;
|
||||
let device_id = sys::SDL_OpenAudioDevice(
|
||||
|
||||
Reference in New Issue
Block a user