Fix error in ghash/gset_ensure_p_ex

The key is needed in the case the ghash resizes.
Caused regression T47984.
This commit is contained in:
Campbell Barton 2016-03-30 03:00:26 +11:00
parent 201d393862
commit de81607efc

@ -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;