[Bf-blender-cvs] [6f5d1e2] master: Add missing spin-lock to IMB_makeSingleUser
Campbell Barton
noreply at git.blender.org
Wed Sep 2 15:29:31 CEST 2015
Commit: 6f5d1e257e727d73d62a1ab4efbbd9fa1332a4e6
Author: Campbell Barton
Date: Wed Sep 2 23:23:44 2015 +1000
Branches: master
https://developer.blender.org/rB6f5d1e257e727d73d62a1ab4efbbd9fa1332a4e6
Add missing spin-lock to IMB_makeSingleUser
===================================================================
M source/blender/imbuf/intern/allocimbuf.c
===================================================================
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 9042c4b..b8771e3 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);
More information about the Bf-blender-cvs
mailing list