]> granicus.if.org Git - php/commitdiff
MFB: fix race condition on font cache shutdown
authorNuno Lopes <nlopess@php.net>
Wed, 4 Apr 2007 14:26:04 +0000 (14:26 +0000)
committerNuno Lopes <nlopess@php.net>
Wed, 4 Apr 2007 14:26:04 +0000 (14:26 +0000)
ext/gd/libgd/gdft.c

index 414f5e28ebbace5d469e1b952bb73fd5295dbe0d..5ddddcea5e9c9873ce6b533c6ce646da36e6a4fe 100644 (file)
@@ -715,13 +715,15 @@ gdroundupdown (FT_F26Dot6 v1, int updown)
 
 void gdFontCacheShutdown()
 {
+       gdMutexLock(gdFontCacheMutex);
+
        if (fontCache) {
-               gdMutexLock(gdFontCacheMutex);
                gdCacheDelete(fontCache);
                fontCache = NULL;
-               gdMutexUnlock(gdFontCacheMutex);
                FT_Done_FreeType(library);
        }
+
+       gdMutexUnlock(gdFontCacheMutex);
 }
 
 void gdFreeFontCache()