From 50401d30555ae9ea420c4abc824024758fcbdfe9 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 11 Aug 2024 18:51:51 +0200 Subject: [PATCH] [css] More dom_node_unref Subsequent calls to el_match_selector cause memleak. Need to resolve it. --- src/document/libdom/css.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/document/libdom/css.c b/src/document/libdom/css.c index 7a3ee1af0..21cfa7304 100644 --- a/src/document/libdom/css.c +++ b/src/document/libdom/css.c @@ -510,6 +510,10 @@ css_error named_ancestor_node(void *pw, void *node, { dom_element_named_ancestor_node(node, qname->name, (struct dom_element **)ancestor); +#ifdef ECMASCRIPT_DEBUG +fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__); +#endif + dom_node_unref(*ancestor); return CSS_OK; } @@ -530,6 +534,9 @@ css_error named_parent_node(void *pw, void *node, { dom_element_named_parent_node(node, qname->name, (struct dom_element **)parent); +#ifdef ECMASCRIPT_DEBUG +fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__); +#endif dom_node_unref(*parent); return CSS_OK; @@ -710,6 +717,9 @@ fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__); css_error parent_node(void *pw, void *node, void **parent) { dom_element_parent_node(node, (struct dom_element **)parent); +#ifdef ECMASCRIPT_DEBUG +fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__); +#endif dom_node_unref(*parent); return CSS_OK; @@ -2502,7 +2512,6 @@ el_match_selector(const char *selector, void *node) } empty: - css_libcss_node_data_handler(&selection_handler, CSS_NODE_DELETED, NULL, node, NULL, NULL); if (style) { css_select_results_destroy(style);