diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-09-06 23:13:23 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-09-06 23:13:23 +0400 |
commit | e7d6537f1c5227005ccddc52987ea720ba66bc80 (patch) | |
tree | 5ac48fd44121194b879fc002d369281494a7598d /source/blender/src/glutil.c | |
parent | d444f25b2864b7d4a9ae39211c695e36ffd813a8 (diff) |
Added support for threadsafe MEM_mallocN/MEM_freeN in the guardedalloc
module itself, replacing the special MEM_mallocT/MEM_freeT functions.
Mutex locking is only enabled when threads are running.
There was no good reason to have these separate, it just led to ugly
hacks when calling functions with non-threadsafe malloc from threads.
Diffstat (limited to 'source/blender/src/glutil.c')
-rw-r--r-- | source/blender/src/glutil.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index dced81579c3..87d20c66ef9 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -297,8 +297,7 @@ void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, /* copy imgw-imgh to a temporal 32 bits rect */ if(img_w<1 || img_h<1) return; - /* happens during threaded render... */ - rc= rect32= MEM_mallocT(img_w*img_h*sizeof(int), "temp 32 bits"); + rc= rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits"); for(y=0; y<img_h; y++) { rf= rectf; @@ -312,8 +311,8 @@ void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, } glaDrawPixelsSafe(fx, fy, img_w, img_h, img_w, GL_RGBA, GL_UNSIGNED_BYTE, rect32); - - MEM_freeT(rect32); + + MEM_freeN(rect32); } void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect) |