summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2011-01-19 21:15:23 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2011-01-19 21:15:23 +0000
commitcd7293320173dfa5ae12810ec51b0708c8bae924 (patch)
tree69d0bab3af1a3ebd47678f1a22bb47f7dc4ce17f /render/box.c
parentf85335a7f9fdbff012409bb2af8fecc81740eab0 (diff)
downloadnetsurf-cd7293320173dfa5ae12810ec51b0708c8bae924.tar.gz
netsurf-cd7293320173dfa5ae12810ec51b0708c8bae924.tar.bz2
Ensure we free more of the css stuff for the box model.
svn path=/trunk/netsurf/; revision=11399
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/render/box.c b/render/box.c
index 613b8c355..d49ae56fa 100644
--- a/render/box.c
+++ b/render/box.c
@@ -85,8 +85,14 @@ void *box_style_alloc(void *ptr, size_t len, void *pw)
static int
free_box_style(struct box *b)
{
- if (b->style != NULL) {
+ if (b->style_owned && b->style != NULL) {
css_computed_style_destroy(b->style);
+ b->style = NULL;
+ }
+
+ if (b->styles != NULL) {
+ css_select_results_destroy(b->styles);
+ b->styles = NULL;
}
return 0;
@@ -121,12 +127,13 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
return 0;
}
- if (style_owned == true)
+ if (style_owned == true || styles != NULL)
talloc_set_destructor(box, free_box_style);
box->type = BOX_INLINE;
box->styles = styles;
box->style = style;
+ box->style_owned = style_owned;
box->x = box->y = 0;
box->width = UNKNOWN_WIDTH;
box->height = 0;