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>2015-09-02 16:23:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-09-02 16:23:44 +0300
commit6f5d1e257e727d73d62a1ab4efbbd9fa1332a4e6 (patch)
treebcc8144ed62606b4a9cfcc1fd1b6299d5de97f38 /source/blender/imbuf/intern/allocimbuf.c
parent525d7e02d48da1f8d415e84898039e647e6bc458 (diff)
Add missing spin-lock to IMB_makeSingleUser
Diffstat (limited to 'source/blender/imbuf/intern/allocimbuf.c')
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 9042c4bd09c..b8771e372cf 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -206,7 +206,18 @@ ImBuf *IMB_makeSingleUser(ImBuf *ibuf)
{
ImBuf *rval;
- if (!ibuf || ibuf->refcounter == 0) { return ibuf; }
+ if (ibuf) {
+ bool is_single;
+ BLI_spin_lock(&refcounter_spin);
+ is_single = (ibuf->refcounter == 0);
+ BLI_spin_unlock(&refcounter_spin);
+ if (is_single) {
+ return ibuf;
+ }
+ }
+ else {
+ return NULL;
+ }
rval = IMB_dupImBuf(ibuf);