Fix leak of box scrollbars.

This commit is contained in:
Michael Drake 2013-10-25 15:47:49 +01:00
parent 1cf0125f2d
commit 88ca82dea2

View File

@ -79,6 +79,8 @@ void *box_style_alloc(void *ptr, size_t len, void *pw)
*/
static int box_talloc_destructor(struct box *b)
{
struct html_scrollbar_data *data;
if ((b->flags & STYLE_OWNED) && b->style != NULL) {
css_computed_style_destroy(b->style);
b->style = NULL;
@ -100,6 +102,18 @@ static int box_talloc_destructor(struct box *b)
dom_node_unref(b->node);
}
if (b->scroll_x != NULL) {
data = scrollbar_get_data(b->scroll_x);
scrollbar_destroy(b->scroll_x);
free(data);
}
if (b->scroll_y != NULL) {
data = scrollbar_get_data(b->scroll_y);
scrollbar_destroy(b->scroll_y);
free(data);
}
return 0;
}