Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-25 14:35:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-25 14:35:24 +0400
commit3c8a4c458bc66cfe54e83c00f2d4460a52e04535 (patch)
tree151c0fa579ac0fcdc7230e8224bfdaf3c3c2ed87 /source/blender/compositor
parentcc0784c1b9c4d813837dedddd5b2b4c52fe291f0 (diff)
more guardedalloc use in C++, also make compositorMutex a static var, was allocated and never freed.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.h9
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp4
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h4
-rw-r--r--source/blender/compositor/intern/COM_Socket.h4
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.h4
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp15
6 files changed, 33 insertions, 7 deletions
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
index ceb5934a7df..68140745f8b 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
@@ -23,6 +23,10 @@
#ifndef _COM_ChunkOrderHotSpot_h_
#define _COM_ChunkOrderHotSpot_h_
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class ChunkOrderHotspot {
private:
int x;
@@ -32,6 +36,11 @@ private:
public:
ChunkOrderHotspot(int x, int y, float addition);
double determineDistance(int x, int y);
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:ChunkOrderHotspot")
+#endif
};
#endif
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 7e09486fd0b..5001cabbd9f 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -41,6 +41,10 @@
#include "BKE_global.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering)
{
context.setbNodeTree(editingtree);
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index f96b994685a..bf2dbd8c9c0 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -270,6 +270,10 @@ protected:
* @brief set if this NodeOperation can be scheduled on a OpenCLDevice
*/
void setOpenCL(bool openCL) { this->openCL = openCL; }
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
+#endif
};
#endif
diff --git a/source/blender/compositor/intern/COM_Socket.h b/source/blender/compositor/intern/COM_Socket.h
index 4f82a490e14..9feef1bae93 100644
--- a/source/blender/compositor/intern/COM_Socket.h
+++ b/source/blender/compositor/intern/COM_Socket.h
@@ -29,6 +29,10 @@
#include "DNA_node_types.h"
#include "COM_defines.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
using namespace std;
class SocketConnection;
class NodeBase;
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
index f4f58e6e007..df8899e8eea 100644
--- a/source/blender/compositor/intern/COM_SocketReader.h
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -25,6 +25,10 @@
#include "BLI_rect.h"
#include "COM_defines.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
typedef enum PixelSampler {
COM_PS_NEAREST,
COM_PS_BILINEAR,
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index bec9ff95eed..ccd3b2e6458 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -33,20 +33,21 @@ extern "C" {
#include "COM_WorkScheduler.h"
#include "OCL_opencl.h"
-static ThreadMutex *compositorMutex;
+static ThreadMutex compositorMutex = {{0}};
+static char is_compositorMutex_init = FALSE;
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
{
- if (compositorMutex == NULL) { /// TODO: move to blender startup phase
- compositorMutex = new ThreadMutex();
- BLI_mutex_init(compositorMutex);
+ if (is_compositorMutex_init == FALSE) { /// TODO: move to blender startup phase
+ BLI_mutex_init(&compositorMutex);
OCL_init();
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
+ is_compositorMutex_init = TRUE;
}
- BLI_mutex_lock(compositorMutex);
+ BLI_mutex_lock(&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(&compositorMutex);
return;
}
@@ -60,5 +61,5 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
system->execute();
delete system;
- BLI_mutex_unlock(compositorMutex);
+ BLI_mutex_unlock(&compositorMutex);
}