From 43d0b6a8b4cc923a53d6e09357811f839a2a32e1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 4 Feb 2017 11:03:04 +0000 Subject: layout: Improve dom watcher creation and destruction. --- src/layout.c | 15 +++++++++++---- 1 file 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; -- cgit v1.2.3