tony2001                Wed Feb 21 18:41:23 2007 UTC

  Modified files:              (Branch: PHP_4_4)
    /php-src    NEWS 
    /php-src/ext/gd/libgd       gdft.c 
  Log:
  MFH: fix #40578 (imagettftext() multithreading issue)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.1247.2.920.2.195&r2=1.1247.2.920.2.196&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.195 php-src/NEWS:1.1247.2.920.2.196
--- php-src/NEWS:1.1247.2.920.2.195     Fri Feb 16 11:47:19 2007
+++ php-src/NEWS        Wed Feb 21 18:41:22 2007
@@ -3,6 +3,7 @@
 ?? ??? 2007, Version 4.4.6
 - Updated PCRE to version 7.0. (Nuno)
 - Fixed segfault in ext/session when register_globals=On. (Tony)
+- Fixed bug #40578 (imagettftext() multithreading issue). (Tony)
 - Fixed bug #40502 (ext/interbase compile failure). (Tony)
 - Fixed bug #40286 (PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when
   parent is killed). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdft.c?r1=1.11.2.19&r2=1.11.2.19.2.1&diff_format=u
Index: php-src/ext/gd/libgd/gdft.c
diff -u php-src/ext/gd/libgd/gdft.c:1.11.2.19 
php-src/ext/gd/libgd/gdft.c:1.11.2.19.2.1
--- php-src/ext/gd/libgd/gdft.c:1.11.2.19       Thu Dec  9 14:20:20 2004
+++ php-src/ext/gd/libgd/gdft.c Wed Feb 21 18:41:23 2007
@@ -196,6 +196,16 @@
 #include "jisx0208.h"
 #endif
 
+extern int any2eucjp (char *, char *, unsigned int);
+
+/* Persistent font cache until explicitly cleared */
+/* Fonts can be used across multiple images */
+
+/* 2.0.16: thread safety (the font cache is shared) */
+gdMutexDeclare(gdFontCacheMutex);
+static gdCache_head_t *fontCache = NULL;
+static FT_Library library;
+
 #define Tcl_UniChar int
 #define TCL_UTF_MAX 3
 static int
@@ -740,9 +750,10 @@
                  /* find antialised color */
        
                  tc_key.bgcolor = *pixel;
-                 tc_elem = (tweencolor_t *) gdCacheGet (
-                                                         tc_cache, &tc_key);
+                 gdMutexLock(gdFontCacheMutex);
+                 tc_elem = (tweencolor_t *) gdCacheGet (tc_cache, &tc_key);
                  *pixel = tc_elem->tweencolor;
+                 gdMutexUnlock(gdFontCacheMutex);
                }
            }
        }
@@ -758,16 +769,6 @@
     : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6);
 }
 
-extern int any2eucjp (char *, char *, unsigned int);
-
-/* Persistent font cache until explicitly cleared */
-/* Fonts can be used across multiple images */
- 
-/* 2.0.16: thread safety (the font cache is shared) */
-gdMutexDeclare(gdFontCacheMutex);
-static gdCache_head_t *fontCache = NULL;
-static FT_Library library;
-
 void gdFontCacheShutdown()
 {
        if (fontCache) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to