Skip to content

Commit

Permalink
lib: Fix blender crash
Browse files Browse the repository at this point in the history
I wasn't doing a deep-copy of the shader tree in set_background, which
caused blender's jemalloc to not be happy when c-ray free'd that stuff.
  • Loading branch information
vkoskiv committed Dec 16, 2023
1 parent 19ab99f commit 0b32052
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/api/c-ray.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ char *cr_get_git_hash() {
return gitHash();
}

struct cr_shader_node *shader_deepcopy(const struct cr_shader_node *in);

// -- Renderer --

struct cr_renderer;
Expand Down Expand Up @@ -212,7 +214,7 @@ bool cr_scene_set_background(struct cr_scene *s_ext, struct cr_shader_node *desc
if (!s_ext) return false;
struct world *s = (struct world *)s_ext;
s->background = desc ? build_bsdf_node(s_ext, desc) : newBackground(&s->storage, NULL, NULL, NULL);
s->bg_desc = desc ? desc : NULL;
s->bg_desc = desc ? shader_deepcopy(desc) : NULL;
return true;
}

Expand Down

0 comments on commit 0b32052

Please sign in to comment.