commit 0186f7488f98e70ffbe404cdc01757ae52e553cb
parent 96c0d9f93955ae7f6fc9953e99799d078661b28c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sat, 13 Apr 2024 12:29:46 +0200
Solver-side radiative environment creation corrected
The solver-side environment was deleted directly after creation, even if
no error was detected. As a result, no radiative environment was ever
defined on the solver side.
Diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/stardis-radiative-env.c b/src/stardis-radiative-env.c
@@ -50,7 +50,7 @@ create_radenv_const
struct sdis_data* data = NULL;
struct radiative_env_const* props = NULL;
res_T res = RES_OK;
- ASSERT(radenv && stardis);
+ ASSERT(radenv && radenv->type == RADIATIVE_ENV_CONST && stardis);
res = sdis_data_create(stardis->dev, sizeof(struct radiative_env_const),
ALIGNOF(struct radiative_env_const), NULL, &data);
@@ -65,11 +65,8 @@ create_radenv_const
if(res != RES_OK) goto error;
exit:
+ /* Release the local reference on the data: it is kept by the sdis radenv */
if(data) SDIS(data_ref_put(data));
- if(radenv->sdis_radenv) {
- SDIS(radiative_env_ref_put(radenv->sdis_radenv));
- radenv->sdis_radenv = NULL;
- }
return res;
error:
goto exit;