Fix reference handling when computing next node.

This commit is contained in:
John-Mark Bell 2012-07-22 17:52:30 +01:00
parent 2ad24f39da
commit 5d8959b30c
1 changed files with 3 additions and 1 deletions

View File

@ -166,7 +166,7 @@ bool xml_to_box(dom_node *n, html_content *c, box_construct_complete_cb cb)
return false;
ctx->content = c;
ctx->n = n;
ctx->n = dom_node_ref(n);
ctx->root_box = NULL;
ctx->cb = cb;
@ -386,6 +386,7 @@ static dom_node *next_node(dom_node *n, html_content *content,
dom_node_unref(n);
return NULL;
}
dom_node_unref(n);
} else {
err = dom_node_get_next_sibling(n, &next);
if (err != DOM_NO_ERR) {
@ -423,6 +424,7 @@ static dom_node *next_node(dom_node *n, html_content *content,
if (parent_next != NULL) {
dom_node_unref(parent_next);
dom_node_unref(parent);
break;
}