Add missing spin-lock to IMB_makeSingleUser

This commit is contained in:
2015-09-02 23:23:44 +10:00
parent 525d7e02d4
commit 6f5d1e257e

View File

@@ -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);