1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

[quickjs] some finalizers

This commit is contained in:
Witold Filipczyk 2023-05-06 10:55:58 +02:00
parent d8794b5aec
commit a754b39287
3 changed files with 15 additions and 3 deletions

View File

@ -117,9 +117,13 @@ static
void js_attr_finalizer(JSRuntime *rt, JSValue val)
{
REF_JS(val);
void *node = JS_GetOpaque(val, js_attr_class_id);
dom_attr *node = (dom_attr *)JS_GetOpaque(val, js_attr_class_id);
attr_erase_from_map(map_attrs, node);
if (node) {
dom_node_unref(node);
}
}
static JSClassDef js_attr_class = {

View File

@ -1713,9 +1713,12 @@ js_doctype_finalizer(JSRuntime *rt, JSValue val)
{
REF_JS(val);
void *node = JS_GetOpaque(val, js_doctype_class_id);
dom_node *node = (dom_node *)JS_GetOpaque(val, js_doctype_class_id);
attr_erase_from_map(map_doctypes, node);
if (node) {
dom_node_unref(node);
}
}
static JSClassDef js_doctype_class = {

View File

@ -2487,6 +2487,11 @@ void js_element_finalizer(JSRuntime *rt, JSValue val)
if (el_private) {
struct element_listener *l;
dom_node *el = (dom_node *)el_private->node;
if (el) {
dom_node_unref(el);
}
foreach(l, el_private->listeners) {
mem_free_set(&l->typ, NULL);