Deleting a collection item while the collection is enumerated does not crash anymore.
[INTERPRETER] * BUG: Deleting a collection item while the collection is enumerated does not crash anymore.
This commit is contained in:
parent
f0e4d6f127
commit
6f06d516b3
2 changed files with 9 additions and 4 deletions
|
@ -69,6 +69,7 @@ static void remove_key(CCOLLECTION *col, const char *key, int len)
|
|||
{
|
||||
void *value;
|
||||
HASH_NODE *last;
|
||||
HASH_NODE *save;
|
||||
void *save_enum;
|
||||
|
||||
if (len == 0)
|
||||
|
@ -77,11 +78,15 @@ static void remove_key(CCOLLECTION *col, const char *key, int len)
|
|||
return;
|
||||
}
|
||||
|
||||
value = HASH_TABLE_lookup(col->hash_table, key, len, FALSE);
|
||||
if (value == NULL)
|
||||
return;
|
||||
save = col->hash_table->last;
|
||||
|
||||
value = HASH_TABLE_lookup(col->hash_table, key, len, TRUE);
|
||||
|
||||
last = col->hash_table->last;
|
||||
col->hash_table->last = save;
|
||||
|
||||
if (value == NULL)
|
||||
return;
|
||||
|
||||
if (last)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue