From 7c17aefdbfe5e53f249826482caf2e0cce132a01 Mon Sep 17 00:00:00 2001
From: dkf <dkf@noemail.net>
Date: Mon, 27 Feb 2006 11:36:01 +0000
Subject: Fix old thread-safety issue. [Bug 470322]

FossilOrigin-Name: d505e258ab9f9431bd759709f59ac0b4c0d47363
---
 ChangeLog          | 3 +++
 generic/tkBitmap.c | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ff04b84..eb6ebbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-02-27  Donal K. Fellows  <donal.k.fellows@manchester.ac.uk>
 
+	* generic/tkBitmap.c (Tk_GetBitmapFromData): Improve thread-safety.
+	[Bug 470322]
+
 	* generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of
 	new Pixmaps before deletion of old ones to prevent stupid caching
 	problems. [Bug 480862]
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 3f9e2e6..c97d5c2 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -11,7 +11,7 @@
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tkBitmap.c,v 1.10 2002/08/05 04:30:38 dgp Exp $
+ * RCS: @(#) $Id: tkBitmap.c,v 1.10.2.1 2006/02/27 11:36:02 dkf Exp $
  */
 
 #include "tkPort.h"
@@ -818,8 +818,12 @@ Tk_GetBitmapFromData(interp, tkwin, source, width, height)
     char string[16 + TCL_INTEGER_SPACE];
     char *name;
     TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
 
-    BitmapInit(dispPtr);
+    if (!tsdPtr->initialized) {
+	BitmapInit(dispPtr);
+    }
 
     nameKey.source = source;
     nameKey.width = width;
-- 
cgit v0.12