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;
|
void *value;
|
||||||
HASH_NODE *last;
|
HASH_NODE *last;
|
||||||
|
HASH_NODE *save;
|
||||||
void *save_enum;
|
void *save_enum;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
@ -77,11 +78,15 @@ static void remove_key(CCOLLECTION *col, const char *key, int len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = HASH_TABLE_lookup(col->hash_table, key, len, FALSE);
|
save = col->hash_table->last;
|
||||||
if (value == NULL)
|
|
||||||
return;
|
value = HASH_TABLE_lookup(col->hash_table, key, len, TRUE);
|
||||||
|
|
||||||
last = col->hash_table->last;
|
last = col->hash_table->last;
|
||||||
|
col->hash_table->last = save;
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (last)
|
if (last)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue