0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-27 01:29:19 -05:00

Remove incorrect uses of Local::from_raw() (#385)

This commit is contained in:
Bert Belder 2020-05-31 13:37:29 +02:00
parent 9540732a6a
commit 8213c0e428
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
2 changed files with 8 additions and 3 deletions

View file

@ -5,6 +5,7 @@ use crate::support::int;
use crate::ArrayBuffer;
use crate::ArrayBufferView;
use crate::Local;
use crate::ToLocal;
extern "C" {
fn v8__ArrayBufferView__Buffer(
@ -21,8 +22,11 @@ extern "C" {
impl ArrayBufferView {
/// Returns underlying ArrayBuffer.
pub fn buffer<'sc>(&self) -> Option<Local<'sc, ArrayBuffer>> {
unsafe { Local::from_raw(v8__ArrayBufferView__Buffer(self)) }
pub fn buffer<'sc>(
&self,
scope: &'_ mut impl ToLocal<'sc>,
) -> Option<Local<'sc, ArrayBuffer>> {
unsafe { scope.to_local(v8__ArrayBufferView__Buffer(self)) }
}
/// Size of a view in bytes.

View file

@ -80,7 +80,8 @@ impl StackTrace {
) -> Option<Local<'sc, StackFrame>> {
let isolate = scope.isolate();
unsafe {
Local::from_raw(v8__StackTrace__GetFrame(self, isolate, index as u32))
let ptr = v8__StackTrace__GetFrame(self, isolate, index as u32);
scope.to_local(ptr)
}
}
}