diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-02 16:23:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-02 16:23:44 +0300 |
commit | 6f5d1e257e727d73d62a1ab4efbbd9fa1332a4e6 (patch) | |
tree | bcc8144ed62606b4a9cfcc1fd1b6299d5de97f38 | |
parent | 525d7e02d48da1f8d415e84898039e647e6bc458 (diff) |
Add missing spin-lock to IMB_makeSingleUser
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 13 |
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); |