summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-12-02 02:10:37 (GMT)
committerhobbs <hobbs>2004-12-02 02:10:37 (GMT)
commitfaf27421f44ec721bbcaa5836e21297f1fa57832 (patch)
tree569cde081bd6b95759a394075519d813986c41a4 /generic/tkImgPhoto.c
parent3051ba20af89c12c489e91c71d04df0bb8afb7ac (diff)
downloadtk-faf27421f44ec721bbcaa5836e21297f1fa57832.zip
tk-faf27421f44ec721bbcaa5836e21297f1fa57832.tar.gz
tk-faf27421f44ec721bbcaa5836e21297f1fa57832.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 46ae9d4..76a07dd 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.51 2004/10/26 14:07:57 patthoyts Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.52 2004/12/02 02:10:37 hobbs Exp $
*/
#include "tkInt.h"
@@ -2784,14 +2784,22 @@ ImgPhotoDisplay(clientData, display, drawable, imageX, imageY, width,
if ((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;
}
@@ -2806,6 +2814,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