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: free event targets properties by gc mark. #929

Merged
merged 2 commits into from
Dec 6, 2021

Conversation

andycall
Copy link
Member

@andycall andycall commented Nov 30, 2021

在一些特殊的条件下(例如节点被卸载)等,gc_mark 无法正确被 GC 掉用,从而导致对象内部和对象本身没有绑定的属性无法释放。
先采用 Object.defineProperty 这样的方式来绑定属性,可以确保属性 100% 可以被 GC 定位并释放

if (JS_IsObject(m_properties))
JS_MarkValue(rt, m_properties, mark_func);
}
void EventTargetInstance::gcMark(JSRuntime* rt, JSValue val, JS_MarkFunc* mark_func) {}
Copy link
Contributor

@yuanyan yuanyan Dec 1, 2021

Choose a reason for hiding this comment

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

这个函数是空的,需要注释说明下,目前c++代码注释是比较少的

@answershuto answershuto merged commit 4aa4603 into main Dec 6, 2021
@answershuto answershuto deleted the fix/event_targets_properties branch December 6, 2021 13:13
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.

3 participants