mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 12:36:51 +03:00
Ensure we free more of the css stuff for the box model.
svn path=/trunk/netsurf/; revision=11399
This commit is contained in:
parent
f85335a7f9
commit
cd72933201
11
render/box.c
11
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;
|
||||
|
@ -141,6 +141,8 @@ struct box {
|
||||
* a box's 'styles' select results, except for implied boxes, where it
|
||||
* is a pointer to an owned computed style. */
|
||||
css_computed_style *style;
|
||||
/** Whether the style is owned by this box. */
|
||||
bool style_owned;
|
||||
|
||||
/** Coordinate of left padding edge relative to parent box, or relative
|
||||
* to ancestor that contains this box in float_children for FLOAT_. */
|
||||
|
Loading…
Reference in New Issue
Block a user