summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-02-09 14:48:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-02-09 14:48:20 (GMT)
commit336606efeef781595867d3cd1a7a8c4cfd7c5996 (patch)
treeaa7e897ab43c04037776f13b81d9d07694de80a1 /generic
parentfefdd508a8ca659fee8e25f3d7e19e1e0e7d62d6 (diff)
downloadtk-336606efeef781595867d3cd1a7a8c4cfd7c5996.zip
tk-336606efeef781595867d3cd1a7a8c4cfd7c5996.tar.gz
tk-336606efeef781595867d3cd1a7a8c4cfd7c5996.tar.bz2
Stop crashes when copying a large photo to itself causes resizing. [Bug 877950]
Diffstat (limited to 'generic')
-rw-r--r--generic/tkImgPhoto.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3b3574e..d5bf02d 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.43 2004/01/13 02:06:00 davygrvy Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.44 2004/02/09 14:48:20 dkf Exp $
*/
#include "tkInt.h"
@@ -4291,6 +4291,7 @@ Tk_PhotoPutBlock(interp, handle, blockPtr, x, y, width, height, compRule)
xEnd = x + width;
yEnd = y + height;
if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
+ int sameSrc = (blockPtr->pixelPtr == masterPtr->pix32);
if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
@@ -4300,6 +4301,10 @@ Tk_PhotoPutBlock(interp, handle, blockPtr, x, y, width, height, compRule)
}
return TCL_ERROR;
}
+ if (sameSrc) {
+ blockPtr->pixelPtr = masterPtr->pix32;
+ blockPtr->pitch = masterPtr->width * 4;
+ }
}
if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
@@ -4610,6 +4615,7 @@ Tk_PhotoPutZoomedBlock(interp, handle, blockPtr, x, y, width, height,
}
if (sameSrc) {
blockPtr->pixelPtr = masterPtr->pix32;
+ blockPtr->pitch = masterPtr->width * 4;
}
}