Fix sequencer crashing after recent GHash refactor.
authorAntony Riakiotakis <kalast@gmail.com>
Fri, 6 Feb 2015 13:28:08 +0000 (14:28 +0100)
committerAntony Riakiotakis <kalast@gmail.com>
Fri, 6 Feb 2015 13:28:08 +0000 (14:28 +0100)
Code frees hash element while iterating - I don't think that's a good
idea but this should keep things working for now at least.

source/blender/imbuf/intern/moviecache.c

index 07080452c246775ffacbcc2ccc4fb4f5c69ce952..a068304e1ce0f85fe96155f08bc74dfdc4b5bfb2 100644 (file)
@@ -144,11 +144,15 @@ static void check_unused_keys(MovieCache *cache)
 {
        GHashIterator gh_iter;
 
-       GHASH_ITER(gh_iter, cache->hash) {
+       BLI_ghashIterator_init(&gh_iter, cache->hash);
+
+       while (!BLI_ghashIterator_done(&gh_iter)) {
                MovieCacheKey *key = BLI_ghashIterator_getKey(&gh_iter);
                MovieCacheItem *item = BLI_ghashIterator_getValue(&gh_iter);
                bool remove;
 
+               BLI_ghashIterator_step(&gh_iter);
+
                remove = !item->ibuf;
 
                if (remove) {