mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-02-01 20:24:56 -05:00
Add Drop impl for CFunctionInfo (#1451)
This deallocates the C++ allocation, preventing a memory leak Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
parent
ab742578f6
commit
f42a8e41e0
2 changed files with 9 additions and 0 deletions
|
@ -2139,6 +2139,8 @@ v8::CFunctionInfo* v8__CFunctionInfo__New(
|
|||
return info.release();
|
||||
}
|
||||
|
||||
void v8__CFunctionInfo__DELETE(v8::CFunctionInfo* self) { delete self; }
|
||||
|
||||
const v8::FunctionTemplate* v8__FunctionTemplate__New(
|
||||
v8::Isolate* isolate, v8::FunctionCallback callback,
|
||||
const v8::Value* data_or_null, const v8::Signature* signature_or_null,
|
||||
|
|
|
@ -20,6 +20,7 @@ extern "C" {
|
|||
args_info: *const CTypeInfo,
|
||||
repr: Int64Representation,
|
||||
) -> *mut CFunctionInfo;
|
||||
fn v8__CFunctionInfo__DELETE(this: &mut CFunctionInfo);
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -47,6 +48,12 @@ impl CFunctionInfo {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for CFunctionInfo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { v8__CFunctionInfo__DELETE(self) };
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct CTypeInfo(Opaque);
|
||||
|
|
Loading…
Add table
Reference in a new issue