mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[mujs] free html_collection in collections's finalizer
This commit is contained in:
parent
1ed5cf1d86
commit
432edc6f65
@ -8,6 +8,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef CONFIG_LIBDOM
|
||||
#include <dom/dom.h>
|
||||
#include <dom/bindings/hubbub/parser.h>
|
||||
#endif
|
||||
|
||||
#include "elinks.h"
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
|
@ -229,7 +229,10 @@ mjs_htmlCollection_toString(js_State *J)
|
||||
static void
|
||||
mjs_htmlCollection_finalizer(js_State *J, void *node)
|
||||
{
|
||||
attr_erase_from_map(map_collections, node);
|
||||
if (node) {
|
||||
dom_html_collection_unref((dom_html_collection *)node);
|
||||
}
|
||||
//attr_erase_from_map(map_collections, node);
|
||||
}
|
||||
|
||||
void
|
||||
@ -247,5 +250,5 @@ mjs_push_collection(js_State *J, void *node)
|
||||
addproperty(J, "length", mjs_htmlCollection_get_property_length, NULL);
|
||||
mjs_htmlCollection_set_items(J, node);
|
||||
}
|
||||
attr_save_in_map(map_collections, node, node);
|
||||
//attr_save_in_map(map_collections, node, node);
|
||||
}
|
||||
|
@ -3035,6 +3035,7 @@ mjs_element_finalizer(js_State *J, void *priv)
|
||||
if (attr_find_in_map(map_elements, el_private) && --el_private->ref_count <= 0) {
|
||||
attr_erase_from_map(map_elements, el_private);
|
||||
attr_erase_from_map(map_privates, el_private->node);
|
||||
dom_node *node = (dom_node *)(el_private->node);
|
||||
|
||||
struct ele_listener *l;
|
||||
|
||||
@ -3047,7 +3048,10 @@ mjs_element_finalizer(js_State *J, void *priv)
|
||||
if (l->fun) js_unref(J, l->fun);
|
||||
}
|
||||
free_list(el_private->listeners);
|
||||
dom_node_unref(el_private->node);
|
||||
|
||||
if (node->refcnt > 0) {
|
||||
dom_node_unref(node);
|
||||
}
|
||||
if (el_private->thisval) {
|
||||
js_unref(J, el_private->thisval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user