diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-10-31 15:43:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-10-31 15:43:42 +0300 |
commit | 3a3ac0de8f13b8c06a6c0dea63107d9d3f151f42 (patch) | |
tree | a434e66aabdf05b8ab3ac2585e8dd810d213ccf3 /source/blender/imbuf/intern | |
parent | 12812e494f63b0c7e5ffcb30c67ca88be9e34513 (diff) |
Fix #23283: crash exiting blender player, IMB_exit got called twice.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/cache.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c index 77e01d8ebef..5650a4f9b94 100644 --- a/source/blender/imbuf/intern/cache.c +++ b/source/blender/imbuf/intern/cache.c @@ -82,6 +82,8 @@ typedef struct ImGlobalTileCache { int totthread; ThreadMutex mutex; + + int initialized; } ImGlobalTileCache; static ImGlobalTileCache GLOBAL_CACHE; @@ -203,6 +205,8 @@ void imb_tile_cache_init(void) /* 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 @@ void imb_tile_cache_exit(void) 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 */ |