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:
authorCampbell Barton <ideasman42@gmail.com>2016-03-29 19:00:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-29 19:04:47 +0300
commitde81607efca43830288cbaf03fe2044d7ca1ce53 (patch)
tree0d76c9283aeffd27e7ac34daaf82bbfa162a693c /source/blender/blenlib/intern/BLI_ghash.c
parent201d393862243013cd23693794c55d80e62a424a (diff)
Fix error in ghash/gset_ensure_p_ex
The key is needed in the case the ghash resizes. Caused regression T47984.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_ghash.c')
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 3233a5840e0..06946e520a8 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -850,8 +850,10 @@ bool BLI_ghash_ensure_p_ex(
const bool haskey = (e != NULL);
if (!haskey) {
+ /* pass 'key' incase we resize */
e = BLI_mempool_alloc(gh->entrypool);
- ghash_insert_ex_keyonly_entry(gh, NULL, bucket_index, (Entry *)e);
+ ghash_insert_ex_keyonly_entry(gh, (void *)key, bucket_index, (Entry *)e);
+ e->e.key = NULL; /* caller must re-assign */
}
*r_key = &e->e.key;
@@ -1406,8 +1408,10 @@ bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key)
const bool haskey = (e != NULL);
if (!haskey) {
+ /* pass 'key' incase we resize */
e = BLI_mempool_alloc(((GHash *)gs)->entrypool);
- ghash_insert_ex_keyonly_entry((GHash *)gs, NULL, bucket_index, (Entry *)e);
+ ghash_insert_ex_keyonly_entry((GHash *)gs, (void *)key, bucket_index, (Entry *)e);
+ e->key = NULL; /* caller must re-assign */
}
*r_key = &e->key;