FreeType: don’t use usable_size() as deallocation size

Instead use C-level malloc()/free() so that the size doesn’t need
to be known during deallocation, since FreeType doesn’t provide it.

Hopefully fixes https://github.com/servo/servo/issues/19058
This commit is contained in:
Simon Sapin 2017-10-30 15:00:41 +01:00
parent 1b73cf3352
commit 6319ad0124
4 changed files with 37 additions and 50 deletions

View file

@ -9,9 +9,9 @@
#[cfg(feature = "unstable")]
#[global_allocator]
static ALLOC: platform::Allocator = platform::Allocator;
static ALLOC: Allocator = Allocator;
pub use platform::usable_size;
pub use platform::*;
#[cfg(all(feature = "unstable", not(windows)))]
@ -25,6 +25,11 @@ mod platform {
pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize {
jemallocator::usable_size(ptr)
}
/// Memory allocation APIs compatible with libc
pub mod libc_compat {
pub use super::jemallocator::ffi::{malloc, realloc, free};
}
}
#[cfg(all(feature = "unstable", windows))]
@ -57,6 +62,10 @@ mod platform {
pub unsafe extern "C" fn usable_size(_ptr: *const c_void) -> usize {
0
}
/// Memory allocation APIs compatible with libc
pub mod libc_compat {
extern crate libc;
pub use self::libc::{malloc, realloc, free};
}
}