[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32793] trunk/blender/source/blender/imbuf /intern/cache.c: Fix #23283: crash exiting blender player, IMB_exit got called twice.
Brecht Van Lommel
brechtvanlommel at pandora.be
Sun Oct 31 13:43:42 CET 2010
Revision: 32793
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32793
Author: blendix
Date: 2010-10-31 13:43:42 +0100 (Sun, 31 Oct 2010)
Log Message:
-----------
Fix #23283: crash exiting blender player, IMB_exit got called twice.
Modified Paths:
--------------
trunk/blender/source/blender/imbuf/intern/cache.c
Modified: trunk/blender/source/blender/imbuf/intern/cache.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/cache.c 2010-10-31 12:31:15 UTC (rev 32792)
+++ trunk/blender/source/blender/imbuf/intern/cache.c 2010-10-31 12:43:42 UTC (rev 32793)
@@ -82,6 +82,8 @@
int totthread;
ThreadMutex mutex;
+
+ int initialized;
} ImGlobalTileCache;
static ImGlobalTileCache GLOBAL_CACHE;
@@ -203,6 +205,8 @@
/* initialize for one thread, for places that access textures
outside of rendering (displace modifier, painting, ..) */
IMB_tile_cache_params(0, 0);
+
+ GLOBAL_CACHE.initialized = 1;
}
void imb_tile_cache_exit(void)
@@ -210,19 +214,23 @@
ImGlobalTile *gtile;
int a;
- for(gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
- imb_global_cache_tile_unload(gtile);
+ if(GLOBAL_CACHE.initialized) {
+ for(gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
+ imb_global_cache_tile_unload(gtile);
- for(a=0; a<GLOBAL_CACHE.totthread; a++)
- imb_thread_cache_exit(&GLOBAL_CACHE.thread_cache[a]);
+ for(a=0; a<GLOBAL_CACHE.totthread; a++)
+ imb_thread_cache_exit(&GLOBAL_CACHE.thread_cache[a]);
- if(GLOBAL_CACHE.memarena)
- BLI_memarena_free(GLOBAL_CACHE.memarena);
+ if(GLOBAL_CACHE.memarena)
+ BLI_memarena_free(GLOBAL_CACHE.memarena);
- if(GLOBAL_CACHE.tilehash)
- BLI_ghash_free(GLOBAL_CACHE.tilehash, NULL, NULL);
+ if(GLOBAL_CACHE.tilehash)
+ BLI_ghash_free(GLOBAL_CACHE.tilehash, NULL, NULL);
- BLI_mutex_end(&GLOBAL_CACHE.mutex);
+ BLI_mutex_end(&GLOBAL_CACHE.mutex);
+
+ memset(&GLOBAL_CACHE, 0, sizeof(ImGlobalTileCache));
+ }
}
/* presumed to be called when no threads are running */
More information about the Bf-blender-cvs
mailing list