[cairo] deleting hash objects while iterating

Keith Packard keithp at keithp.com
Sun Apr 9 00:59:52 PDT 2006


I discovered that _cairo_hash_table_foreach walks over the hash table
without preventing it from being resized as a result of deletions
occuring from the callback.

Kinda nasty when you're trying to free everything from a hash table.

It was also easy to fix; just prevent the table from being resized while
iterating and clean it up after the iteration is completed.

Is this a reasonable thing to do?

http://gitweb.freedesktop.org/?p=users-keithp-cairo;a=commitdiff;h=da2c5e44abd98f1f1aed4f716b7e9bc97a667058;hp=ade195cdba5b0d13c121e44709151bfbb0c44085

shows the changes needed.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060409/5bff6134/attachment.pgp


More information about the cairo mailing list