summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2008-11-19 00:37:35 (GMT)
committernijtmans <nijtmans>2008-11-19 00:37:35 (GMT)
commit8d02f3eefb3c880f59c76afb60f1e0fd64c77d0f (patch)
tree36b02c8bfa575ab7256c4fe4b6bf34b3194c8490 /generic/tkImgPhoto.c
parentaf6b3cd3e4c83b73e3c84cfd656bffd05523d141 (diff)
downloadtk-8d02f3eefb3c880f59c76afb60f1e0fd64c77d0f.zip
tk-8d02f3eefb3c880f59c76afb60f1e0fd64c77d0f.tar.gz
tk-8d02f3eefb3c880f59c76afb60f1e0fd64c77d0f.tar.bz2
Relax the constraint that every Tk_ImageType
can only be passed to Tk_CreateImageType once. This allows tkImg to be loaded in multiple interpreters in a thread-enabled build of Tk. [Bug 2312027]
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index eff0fde..c9acc4d 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.76 2007/12/13 15:24:14 dgp Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.76.2.1 2008/11/19 00:37:35 nijtmans Exp $
*/
#include "tkInt.h"
@@ -473,13 +473,11 @@ PhotoFormatThreadExitProc(
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
- ckfree((char *) freePtr->name);
ckfree((char *) freePtr);
}
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
- ckfree((char *) freePtr->name);
ckfree((char *) freePtr);
}
}
@@ -508,8 +506,7 @@ Tk_CreateOldPhotoImageFormat(
Tk_PhotoImageFormat *formatPtr)
/* Structure describing the format. All of the
* fields except "nextPtr" must be filled in
- * by caller. Must not have been passed to
- * Tk_CreatePhotoImageFormat previously. */
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -521,8 +518,6 @@ Tk_CreateOldPhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy(copyPtr->name, formatPtr->name);
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
}
@@ -532,8 +527,7 @@ Tk_CreatePhotoImageFormat(
Tk_PhotoImageFormat *formatPtr)
/* Structure describing the format. All of the
* fields except "nextPtr" must be filled in
- * by caller. Must not have been passed to
- * Tk_CreatePhotoImageFormat previously. */
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -545,8 +539,6 @@ Tk_CreatePhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = (char *) ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy(copyPtr->name, formatPtr->name);
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
@@ -4279,7 +4271,7 @@ Tk_FindPhoto(
Tk_ImageType *typePtr;
clientData = Tk_GetImageMasterData(interp, imageName, &typePtr);
- if (typePtr != &tkPhotoImageType) {
+ if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
return NULL;
}
return (Tk_PhotoHandle) clientData;