mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 09:18:11 +02:00
Remove the entry if we return an error code during _cair_hash_table_insert.
Previously if we detected an error during resize we would report a failure to insert the entry into the hash table having already done so.
This commit is contained in:
parent
1cdb54f883
commit
4a624b8e8b
1 changed files with 9 additions and 2 deletions
|
|
@ -481,8 +481,12 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table,
|
|||
hash_table->live_entries++;
|
||||
|
||||
status = _cairo_hash_table_resize (hash_table);
|
||||
if (status)
|
||||
if (status) {
|
||||
/* abort the insert... */
|
||||
*entry = DEAD_ENTRY;
|
||||
hash_table->live_entries--;
|
||||
return status;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
@ -561,6 +565,9 @@ _cairo_hash_table_foreach (cairo_hash_table_t *hash_table,
|
|||
* the table may need resizing. Just do this every time
|
||||
* as the check is inexpensive.
|
||||
*/
|
||||
if (--hash_table->iterating == 0)
|
||||
if (--hash_table->iterating == 0) {
|
||||
/* Should we fail to shrink the hash table, it is left unaltered,
|
||||
* and we don't need to propagate the error status. */
|
||||
_cairo_hash_table_resize (hash_table);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue