File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ impl AudioUnit {
157157 if let Some ( callback) = self . callback {
158158 // Here, we transfer ownership of the callback back to the current scope so that it
159159 // is dropped and cleaned up. Without this line, we would leak the Boxed callback.
160- let _: Box < Box < RenderCallback > > = unsafe { mem :: transmute ( callback) } ;
160+ let _: Box < Box < RenderCallback > > = unsafe { Box :: from_raw ( callback as * mut Box < RenderCallback > ) } ;
161161 }
162162 }
163163
@@ -167,13 +167,13 @@ impl AudioUnit {
167167 unsafe {
168168 // Setup render callback. Notice that we relinquish ownership of the Callback
169169 // here so that it can be used as the C render callback via a void pointer.
170- // We do however store the *mut so that we can transmute back to a
170+ // We do however store the *mut so that we can convert back to a
171171 // Box<Box<RenderCallback>> within our AudioUnit's Drop implementation
172172 // (otherwise it would leak). The double-boxing is due to incompleteness with
173- // Rust's FnMut implemetation and is necessary to be able to transmute to the
173+ // Rust's FnMut implemetation and is necessary to be able to convert to the
174174 // correct pointer size.
175- let callback_ptr: * mut libc :: c_void = match f {
176- Some ( x) => mem :: transmute ( Box :: new ( x) ) ,
175+ let callback_ptr = match f {
176+ Some ( x) => Box :: into_raw ( Box :: new ( x) ) as * mut libc :: c_void ,
177177 _ => ptr:: null_mut ( )
178178 } ;
179179 let render_callback = au:: AURenderCallbackStruct {
You can’t perform that action at this time.
0 commit comments