summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-02-04 11:03:04 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2017-02-04 12:01:58 (GMT)
commit43d0b6a8b4cc923a53d6e09357811f839a2a32e1 (patch)
treed4b1ef77157e217b9c555d7084c38e63ebe78384
parent9c10dfcb92088e2a89939c58560e89ddd0b69228 (diff)
downloadlibnslayout-43d0b6a8b4cc923a53d6e09357811f839a2a32e1.tar.gz
libnslayout-43d0b6a8b4cc923a53d6e09357811f839a2a32e1.tar.bz2
layout: Improve dom watcher creation and destruction.
-rw-r--r--src/layout.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/layout.c b/src/layout.c
index 1c341b6..1f90951 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -41,6 +41,7 @@ nslayout_error nslayout_layout_create(
nslayout_layout **layout)
{
nslayout_layout *l = NULL;
+ nslayout_error err;
assert(doc != NULL);
assert(css_ctx != NULL);
@@ -61,8 +62,10 @@ nslayout_error nslayout_layout_create(
l->cb = cb;
l->pw = pw;
- /* TODO: error handling */
- nsl_dom_watcher_add_for_layout(l);
+ err = nsl_dom_watcher_add_for_layout(l);
+ if (err != NSLAYOUT_OK) {
+ return err;
+ }
*layout = l;
return NSLAYOUT_OK;
@@ -73,11 +76,15 @@ nslayout_error nslayout_layout_create(
nslayout_error nslayout_layout_destroy(
nslayout_layout *layout)
{
+ nslayout_error err;
+
assert(layout != NULL);
/* TODO: free/unref the stuff we own in the layout */
- /* TODO: error handling */
- nsl_dom_watcher_remove_for_layout(layout);
+ err = nsl_dom_watcher_remove_for_layout(layout);
+ if (err != NSLAYOUT_OK) {
+ return err;
+ }
free(layout);
return NSLAYOUT_OK;