diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2021-02-06 18:07:06 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2021-02-06 18:07:06 (GMT) |
commit | d09b260e24e82ada4a1b0ea0a2383df28571a1ad (patch) | |
tree | cdeb9f8d35804cf10f48475e4c6033c18b99557a | |
parent | d55cbcd9f8665a381c289d6cf13fe5fd2b3e0be9 (diff) | |
download | tk-d09b260e24e82ada4a1b0ea0a2383df28571a1ad.zip tk-d09b260e24e82ada4a1b0ea0a2383df28571a1ad.tar.gz tk-d09b260e24e82ada4a1b0ea0a2383df28571a1ad.tar.bz2 |
TIP-529 metadata dict: on unused output metadata dict, recreate it also, if driver has shared the object.
-rw-r--r-- | generic/tkImgPhoto.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 37b18db..37977f1 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2866,16 +2866,15 @@ if (formatPtr == NULL) { } /* - * Clear eventual set keys in the metadata object + * Check if driver has shared or changed the metadata tcl object. + * In this case, release and recreate it. */ if (metadataOutObj != NULL) { int dictSize; - if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) + if (Tcl_IsShared(metadataOutObj) + || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { - /* - * Driver has modified the metadata dict, so clear it - */ Tcl_DecrRefCount(metadataOutObj); metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); @@ -3069,16 +3068,15 @@ MatchStringFormat( } /* - * Clear eventual set keys in the metadata object + * Check if driver has shared or changed the metadata tcl object. + * In this case, release and recreate it. */ if (metadataOutObj != NULL) { int dictSize; - if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) + if (Tcl_IsShared(metadataOutObj) + || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { - /* - * Driver has modified the metadata dict, so clear it - */ Tcl_DecrRefCount(metadataOutObj); metadataOutObj = Tcl_NewDictObj(); Tcl_IncrRefCount(metadataOutObj); |