Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-09 21:48:05 +0300
committerAntonioya <blendergit@gmail.com>2018-08-10 14:14:13 +0300
commit69d710187d5ae5e5e8b54761187ef8770f3fbb00 (patch)
treebf24eeb345ad54086b03559b1d956514571c842d
parent98c304e865f87a658778781f4280107ed449091c (diff)
Fix unreported assert error when change instance modifier
Doing very fast change in the number of instances soemtimes get an error of duplicate ghash entry.
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 0a805fa9b29..f8a04a06d80 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1230,19 +1230,33 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
gpl->runtime.derived_data = (GHash *)BLI_ghash_str_new(gpl->info);
}
- derived_gpf = BLI_ghash_lookup(gpl->runtime.derived_data, ob->id.name);
+ if (BLI_ghash_haskey(gpl->runtime.derived_data, ob->id.name)) {
+ derived_gpf = BLI_ghash_lookup(gpl->runtime.derived_data, ob->id.name);
+ }
+ else {
+ derived_gpf = NULL;
+ }
+
if (derived_gpf == NULL) {
cache->is_dirty = true;
}
if (cache->is_dirty) {
if (derived_gpf != NULL) {
/* first clear temp data */
+ if (BLI_ghash_haskey(gpl->runtime.derived_data, ob->id.name)) {
+ BLI_ghash_remove(gpl->runtime.derived_data, ob->id.name, NULL, NULL);
+ }
+
BKE_gpencil_free_frame_runtime_data(derived_gpf);
- BLI_ghash_remove(gpl->runtime.derived_data, ob->id.name, NULL, NULL);
}
/* create new data */
derived_gpf = BKE_gpencil_frame_duplicate(gpf);
- BLI_ghash_insert(gpl->runtime.derived_data, ob->id.name, derived_gpf);
+ if (!BLI_ghash_haskey(gpl->runtime.derived_data, ob->id.name)) {
+ BLI_ghash_insert(gpl->runtime.derived_data, ob->id.name, derived_gpf);
+ }
+ else {
+ BLI_ghash_reinsert(gpl->runtime.derived_data, ob->id.name, derived_gpf, NULL, NULL);
+ }
}
/* draw onion skins */