Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli/napi): handle all property variants in napi_define_properties #17680

Merged
merged 8 commits into from
Feb 10, 2023

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Feb 7, 2023

Fixes #17509

This fixes the bug that blocked loading fsevents in Deno.

@littledivy littledivy marked this pull request as ready for review February 8, 2023 05:34
@littledivy littledivy changed the title fix: handle all property variants in napi_define_properties fix(cli/napi): handle all property variants in napi_define_properties Feb 8, 2023
test_napi/src/properties.rs Outdated Show resolved Hide resolved
method: None,
getter: None,
setter: None,
data: ptr::null_mut(),
attributes: enumerable,
value: number,
},
// TODO(@littledivy): Fix this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's not working here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name field isn't handled correctly. #17712

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -27,7 +27,7 @@ pub mod typedarray;
#[macro_export]
macro_rules! cstr {
($s: literal) => {{
std::ffi::CString::new($s).unwrap().as_ptr()
std::ffi::CString::new($s).unwrap().into_raw()
Copy link
Member Author

@littledivy littledivy Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the allocated cstring wasn't leaked so the pointer from .as_ptr was dangling. into_raw leaks it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@littledivy littledivy enabled auto-merge (squash) February 10, 2023 12:37
@littledivy littledivy merged commit 4baaa24 into denoland:main Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

napi_define_properties does not handle getter and setter
2 participants