diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-12-10 12:31:55 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-12-10 12:31:55 (GMT) |
commit | ae6c3c15f60d72b35c871fbfc3f29269c2a3405b (patch) | |
tree | 228fbaa9f5048b25e8d826c005fad09b990c8b56 /generic/tkImgPhoto.c | |
parent | e9f1a4f1b05e6570c1e5f05f50af070153b9fe87 (diff) | |
parent | 77321e10c36d6e107a3dab3eb0ac41a7bcf8632e (diff) | |
download | tk-ae6c3c15f60d72b35c871fbfc3f29269c2a3405b.zip tk-ae6c3c15f60d72b35c871fbfc3f29269c2a3405b.tar.gz tk-ae6c3c15f60d72b35c871fbfc3f29269c2a3405b.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r-- | generic/tkImgPhoto.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 7f3f228..647eb17 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -657,9 +657,6 @@ ImgPhotoCmd( if ((options.fromX2 > block.width) || (options.fromY2 > block.height) || (options.fromX2 > block.width) || (options.fromY2 > block.height)) { - if (options.background) { - Tk_FreeColor(options.background); - } Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); @@ -736,9 +733,6 @@ ImgPhotoCmd( if (options.options & OPT_SHRINK) { if (ImgPhotoSetSize(modelPtr, options.toX2, options.toY2) != TCL_OK) { - if (options.background) { - Tk_FreeColor(options.background); - } Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); @@ -749,9 +743,6 @@ ImgPhotoCmd( Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } - if (options.background) { - Tk_FreeColor(options.background); - } return result; case PHOTO_DATA: { @@ -781,6 +772,9 @@ ImgPhotoCmd( } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?"); + if (options.background) { + Tk_FreeColor(options.background); + } return TCL_ERROR; } if ((options.fromX > modelPtr->width) @@ -790,6 +784,9 @@ ImgPhotoCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + if (options.background) { + Tk_FreeColor(options.background); + } return TCL_ERROR; } @@ -913,21 +910,21 @@ ImgPhotoCmd( if (data) { ckfree(data); } - if (freeObj != NULL) { - Tcl_DecrRefCount(freeObj); - } + if (freeObj != NULL) { + Tcl_DecrRefCount(freeObj); + } return result; dataErrorExit: - if (options.background) { + if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } - if (freeObj != NULL) { - Tcl_DecrRefCount(freeObj); - } + if (freeObj != NULL) { + Tcl_DecrRefCount(freeObj); + } return TCL_ERROR; } @@ -1444,6 +1441,9 @@ readCleanup: } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?"); + if (options.background) { + Tk_FreeColor(options.background); + } return TCL_ERROR; } if ((options.fromX > modelPtr->width) @@ -1453,6 +1453,9 @@ readCleanup: Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + if (options.background) { + Tk_FreeColor(options.background); + } return TCL_ERROR; } @@ -1561,6 +1564,9 @@ readCleanup: } Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", fmtString, NULL); + if (options.background) { + Tk_FreeColor(options.background); + } return TCL_ERROR; } @@ -2140,7 +2146,6 @@ ImgPhotoConfigureModel( if ((modelPtr->fileString != NULL) && ((modelPtr->fileString != oldFileString) || (modelPtr->format != oldFormat))) { - /* * Prevent file system access in a safe interpreter. */ |