diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-22 14:12:59 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-22 14:25:32 +0300 |
commit | ab063db34d60bdda6a683b13cef36d93ad6e760f (patch) | |
tree | ba982105300099bf04f4c4bd95bd57e2aad51445 /source/blender/editors/space_view3d/view3d_draw.c | |
parent | 3f1111b2a82fe975fdb55114943009e8ef0a2c43 (diff) |
Cleanup: deduplicate free code
It is more appropriate that `depths` is freed in `ED_view3d_depths_free`.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c024bab355d..2e46deea0e8 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2322,7 +2322,10 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, ViewDepths **r_depths) { if (v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN) { - return; + /* Force redraw if `r_depths` is required. */ + if (!r_depths || *r_depths != NULL) { + return; + } } struct bThemeState theme_state; Scene *scene = DEG_get_evaluated_scene(depsgraph); @@ -2365,6 +2368,9 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, } if (r_depths) { + if (*r_depths) { + ED_view3d_depths_free(*r_depths); + } *r_depths = view3d_depths_create(region); } } @@ -2384,6 +2390,7 @@ void ED_view3d_depths_free(ViewDepths *depths) if (depths->depths) { MEM_freeN(depths->depths); } + MEM_freeN(depths); } /** \} */ |