summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-12-02 02:07:28 (GMT)
committerhobbs <hobbs>2004-12-02 02:07:28 (GMT)
commitf05c4096922005b6c2fa4df40ea6931bd2f541f5 (patch)
treee9ea122e7b73642e0610509655485611db1021a4 /generic/tkImgPhoto.c
parent800fcf0cd1243bb7de1357c85bd5fff2660dfd96 (diff)
downloadtk-f05c4096922005b6c2fa4df40ea6931bd2f541f5.zip
tk-f05c4096922005b6c2fa4df40ea6931bd2f541f5.tar.gz
tk-f05c4096922005b6c2fa4df40ea6931bd2f541f5.tar.bz2
* unix/tkUnixButton.c (TkpDisplayButton): constrain coords to
Tk_RedrawImage to display only portion that is valid. * generic/tkImgPhoto.c (ImgPhotoDisplay): add X error suppression around XGetImage to prevent app abort. [Bug 979239]
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index e6b7846..f9445af 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.36.2.10 2004/08/05 08:57:50 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.11 2004/12/02 02:07:42 hobbs Exp $
*/
#include "tkInt.h"
@@ -2771,14 +2771,22 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
(instancePtr->masterPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
+ Tk_ErrorHandler handler;
XImage *bgImg = NULL;
/*
+ * Create an error handler to suppress the case where the input was
+ * not properly constrained, which can cause an X error. [Bug 979239]
+ */
+ handler = Tk_CreateErrorHandler(display, -1, -1, -1,
+ (Tk_ErrorProc *) NULL, (ClientData) NULL);
+ /*
* Pull the current background from the display to blend with
*/
bgImg = XGetImage(display, drawable, drawableX, drawableY,
(unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap);
if (bgImg == NULL) {
+ Tk_DeleteErrorHandler(handler);
return;
}
@@ -2793,6 +2801,7 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
bgImg, 0, 0, drawableX, drawableY,
(unsigned int) width, (unsigned int) height);
XDestroyImage(bgImg);
+ Tk_DeleteErrorHandler(handler);
} else {
/*
* masterPtr->region describes which parts of the image contain