diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-11-06 12:35:52 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-11-06 13:24:14 -0800 |
commit | 6000c44d076725c58108e86c43d125bbcd2b78f1 (patch) | |
tree | 7de2abf721ac4353073dabf6cc7e1cc41cd6d01d | |
parent | 6c308c6f1220bc8ba4c3aa54510ad852123421e4 (diff) |
modules/compose: handle layers/texture create failures
Some trivial error handling improvements for compose...
til_module_t.create_context() should really return -errno
instead, since some modules try do stuff like opening files or
network connections @ create_context().
-rw-r--r-- | src/modules/compose/compose.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index e45538c..3e99049 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -73,7 +73,8 @@ static til_module_context_t * compose_create_context(const til_module_t *module, const til_module_t *layer_module; layer_module = ((compose_setup_t *)setup)->layers[i].module_setup->creator; - (void) til_module_create_context(layer_module, stream, rand_r(&seed), ticks, n_cpus, s->layers[i].module_setup, &ctxt->layers[i].module_ctxt); /* TODO: errors */ + if (til_module_create_context(layer_module, stream, rand_r(&seed), ticks, n_cpus, s->layers[i].module_setup, &ctxt->layers[i].module_ctxt) < 0) + return til_module_context_free(&ctxt->til_module_context); ctxt->n_layers++; } @@ -82,7 +83,8 @@ static til_module_context_t * compose_create_context(const til_module_t *module, const til_module_t *texture_module; texture_module = ((compose_setup_t *)setup)->texture.module_setup->creator; - (void) til_module_create_context(texture_module, stream, rand_r(&seed), ticks, n_cpus, s->texture.module_setup, &ctxt->texture.module_ctxt); /* TODO: errors */ + if (til_module_create_context(texture_module, stream, rand_r(&seed), ticks, n_cpus, s->texture.module_setup, &ctxt->texture.module_ctxt) < 0) + return til_module_context_free(&ctxt->til_module_context); } return &ctxt->til_module_context; |