diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-04-07 17:54:16 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-04-07 17:54:16 +0200 |
commit | b5d41aa8a5171a65a060df62abb5847a98ab334a (patch) | |
tree | f9591a77c5ddd30e5f8210e55e18ab1374a75b57 /ports/cef/wrappers.rs | |
parent | dd7ec693a5f3d1ac81bfbdfe20c99c3ff8c5532c (diff) | |
download | servo-b5d41aa8a5171a65a060df62abb5847a98ab334a.tar.gz servo-b5d41aa8a5171a65a060df62abb5847a98ab334a.zip |
Use boxed::into_raw where it makes sense.
Diffstat (limited to 'ports/cef/wrappers.rs')
-rw-r--r-- | ports/cef/wrappers.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index d955aac62b0..f1da9106df2 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -32,6 +32,7 @@ use types::{cef_window_info_t, cef_xml_encoding_type_t, cef_xml_node_type_t}; use unicode::str::Utf16Encoder; use libc::{self, c_char, c_int, c_ushort, c_void}; +use std::boxed; use std::collections::HashMap; use std::mem; use std::ptr; @@ -187,14 +188,11 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] { // FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch // stack space to create the object in. What a botch. - let boxed_string = box cef_string_utf16 { + boxed::into_raw(box cef_string_utf16 { str: ptr, length: buffer.len() as u64, dtor: Some(free_boxed_utf16_string as extern "C" fn(*mut c_ushort)), - }; - let result: *const cef_string_utf16 = &*boxed_string; - mem::forget(boxed_string); - result + }) as *const _ } } unsafe fn to_rust(cef_string: *const cef_string_t) -> &'a [u16] { |