From 7d2a62ef65e075d10ac57aaf170f5c08e2e5b267 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 29 Sep 2015 19:54:25 +0200 Subject: Fix T46299: Windows: File Browser Crash while listing big folders in preview mode (fonts, images...). Windows-only bug, mmap & co are not threadsafe by default on this platform, so we have to add a dedicated spinlock for them in win32. Note that we may try to get rid of those mmap later, but not for 2.76! To be backported to final 2.76... --- source/blender/imbuf/intern/allocimbuf.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source/blender/imbuf/intern/allocimbuf.c') diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 5c79eb2c544..19b68b17e70 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -62,6 +62,30 @@ void imb_refcounter_lock_exit(void) BLI_spin_end(&refcounter_spin); } +#ifdef WIN32 +static SpinLock mmap_spin; + +void imb_mmap_lock_init(void) +{ + BLI_spin_init(&mmap_spin); +} + +void imb_mmap_lock_exit(void) +{ + BLI_spin_end(&mmap_spin); +} + +void imb_mmap_lock(void) +{ + BLI_spin_lock(&mmap_spin); +} + +void imb_mmap_unlock(void) +{ + BLI_spin_unlock(&mmap_spin); +} +#endif + void imb_freemipmapImBuf(ImBuf *ibuf) { int a; -- cgit v1.2.3