Add destructor for wasapi::Channel

This commit is contained in:
Pierre Krieger 2014-12-11 19:42:04 +01:00
parent 99c23327d8
commit 8efaf06ec2
1 changed files with 16 additions and 0 deletions

View File

@ -90,6 +90,22 @@ impl Channel {
} }
} }
impl Drop for Channel {
fn drop(&mut self) {
unsafe {
{
let f = self.render_client.as_mut().unwrap().lpVtbl.as_ref().unwrap().Release;
f(self.render_client);
}
{
let f = self.audio_client.as_mut().unwrap().lpVtbl.as_ref().unwrap().Release;
f(self.audio_client);
}
}
}
}
impl<'a> Buffer<'a> { impl<'a> Buffer<'a> {
pub fn get_buffer(&mut self) -> &mut [u8] { pub fn get_buffer(&mut self) -> &mut [u8] {
self.buffer.as_mut_slice() self.buffer.as_mut_slice()