tony2001                Wed Feb 21 15:00:27 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /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.2027.2.547.2.555&r2=1.2027.2.547.2.556&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.555 php-src/NEWS:1.2027.2.547.2.556
--- php-src/NEWS:1.2027.2.547.2.555     Wed Feb 21 14:25:27 2007
+++ php-src/NEWS        Wed Feb 21 15:00:26 2007
@@ -9,6 +9,7 @@
 - Added --ri switch to CLI which allows to check extension information. 
(Marcus)
 - Added tidyNode::getParent() method (John, Nuno)
 - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry)
+- Fixed bug #40578 (imagettftext() multithreading issue). (Tony)
 - Fixed bug #40576 (double values are truncated to 6 decimal digits when 
   encoding). (Tony)
 - Fixed bug #40560 (DIR functions do not work on root UNC path). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdft.c?r1=1.36.4.2&r2=1.36.4.3&diff_format=u
Index: php-src/ext/gd/libgd/gdft.c
diff -u php-src/ext/gd/libgd/gdft.c:1.36.4.2 
php-src/ext/gd/libgd/gdft.c:1.36.4.3
--- php-src/ext/gd/libgd/gdft.c:1.36.4.2        Fri Sep 15 16:11:39 2006
+++ php-src/ext/gd/libgd/gdft.c Wed Feb 21 15:00:26 2007
@@ -192,6 +192,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 gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr)
@@ -688,8 +698,10 @@
                                } else {
                                        /* find antialised color */
                                        tc_key.bgcolor = *pixel;
+                                       gdMutexLock(gdFontCacheMutex);
                                        tc_elem = (tweencolor_t *) 
gdCacheGet(tc_cache, &tc_key);
                                        *pixel = tc_elem->tweencolor;
+                                       gdMutexUnlock(gdFontCacheMutex);
                                }
                        }
                }
@@ -703,16 +715,6 @@
        return (!updown) ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 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