In case the 'func' is deleting the state move the iterator before
authorZack Rusin <zack@tungstengraphics.com>
Tue, 22 Apr 2008 22:32:29 +0000 (18:32 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Tue, 22 Apr 2008 22:32:36 +0000 (18:32 -0400)
calling it.

src/gallium/auxiliary/cso_cache/cso_cache.c

index f607528fdc72daa314162df5826c75da44b3a2f3..63464e070581b17dd4b3367c0ccad608846a61d0 100644 (file)
@@ -334,10 +334,10 @@ void cso_for_each_state(struct cso_cache *sc, enum cso_cache_type type,
    iter = cso_hash_first_node(hash);
    while (!cso_hash_iter_is_null(iter)) {
       void *state = cso_hash_iter_data(iter);
+      iter = cso_hash_iter_next(iter);
       if (state) {
          func(state, user_data);
       }
-      iter = cso_hash_iter_next(iter);
    }
 }