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