[Bf-blender-cvs] [c69497905bf] greasepencil-object: Fix double free in cache_node_update
Falk David
noreply at git.blender.org
Mon Feb 7 18:35:14 CET 2022
Commit: c69497905bf00194562c83ac9a787060567677ce
Author: Falk David
Date: Thu Feb 3 16:18:26 2022 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc69497905bf00194562c83ac9a787060567677ce
Fix double free in cache_node_update
===================================================================
M source/blender/blenkernel/intern/gpencil_update_cache.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_update_cache.c b/source/blender/blenkernel/intern/gpencil_update_cache.c
index 82205716f59..61d68bab37f 100644
--- a/source/blender/blenkernel/intern/gpencil_update_cache.c
+++ b/source/blender/blenkernel/intern/gpencil_update_cache.c
@@ -100,8 +100,9 @@ static void cache_node_update(void *node, void *data)
/* In case the new cache does a full update, remove its children since they will be all
* updated by this cache. */
if (new_update_cache->flag == GP_UPDATE_NODE_FULL_COPY && update_cache->children != NULL) {
+ /* We don't free the tree itself here, because we just want to clear the children, not delete
+ * the whole node. */
BLI_dlrbTree_free(update_cache->children, cache_node_free);
- MEM_freeN(update_cache->children);
}
update_cache_free(new_update_cache);
@@ -183,10 +184,6 @@ static void update_cache_node_create(
return;
}
- if (gpd->flag & GP_DATA_UPDATE_CACHE_UNDO_ENCODED) {
- BKE_gpencil_free_update_cache(gpd);
- }
-
GPencilUpdateCache *root_cache = gpd->runtime.update_cache;
if (root_cache == NULL) {
gpd->runtime.update_cache = update_cache_alloc(0, GP_UPDATE_NODE_NO_COPY, NULL);
More information about the Bf-blender-cvs
mailing list