diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-08-13 14:56:36 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-08-13 14:56:36 +0400 |
commit | e28fcec04201fb3be19960a0b91fcb20f8d6c56d (patch) | |
tree | dffeb25323ad214ac86f6b4cb0d126d729643eba /source/blender/compositor/intern/COM_compositor.cpp | |
parent | 64e0202314531f2435d518f522b8f06e956c2f3d (diff) |
Fix for [#32220] regression - DistortionCache is never freed.
* at max 10 cache items will be available. Items will be removed by
latest usage.
* number of cached items can be adjusted in code
* added deinitialization of compositor when blender exists.
* updated scons and cmake build files
Diffstat (limited to 'source/blender/compositor/intern/COM_compositor.cpp')
-rw-r--r-- | source/blender/compositor/intern/COM_compositor.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 2402f9a1163..7dcb3572a14 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -32,23 +32,24 @@ extern "C" { #include "COM_ExecutionSystem.h" #include "COM_WorkScheduler.h" #include "OCL_opencl.h" +#include "COM_MovieDistortionOperation.h" -static ThreadMutex compositorMutex; +static ThreadMutex s_compositorMutex; static char is_compositorMutex_init = FALSE; void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) { if (is_compositorMutex_init == FALSE) { /// TODO: move to blender startup phase - memset(&compositorMutex, 0, sizeof(compositorMutex)); - BLI_mutex_init(&compositorMutex); + memset(&s_compositorMutex, 0, sizeof(s_compositorMutex)); + BLI_mutex_init(&s_compositorMutex); OCL_init(); WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere is_compositorMutex_init = TRUE; } - BLI_mutex_lock(&compositorMutex); + BLI_mutex_lock(&s_compositorMutex); if (editingtree->test_break(editingtree->tbh)) { // during editing multiple calls to this method can be triggered. // make sure one the last one will be doing the work. - BLI_mutex_unlock(&compositorMutex); + BLI_mutex_unlock(&s_compositorMutex); return; } @@ -67,7 +68,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) if (editingtree->test_break(editingtree->tbh)) { // during editing multiple calls to this method can be triggered. // make sure one the last one will be doing the work. - BLI_mutex_unlock(&compositorMutex); + BLI_mutex_unlock(&s_compositorMutex); return; } } @@ -77,5 +78,18 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) system->execute(); delete system; - BLI_mutex_unlock(&compositorMutex); + BLI_mutex_unlock(&s_compositorMutex); +} + +void COM_deinitialize() +{ + if (is_compositorMutex_init) + { + BLI_mutex_lock(&s_compositorMutex); + deintializeDistortionCache(); + WorkScheduler::deinitialize(); + is_compositorMutex_init = FALSE; + BLI_mutex_unlock(&s_compositorMutex); + BLI_mutex_end(&s_compositorMutex); + } } |