summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2004-12-02 02:10:37 (GMT)
committerhobbs <hobbs@noemail.net>2004-12-02 02:10:37 (GMT)
commitdcb1b688238afd4ac4b219aa0a63b4dd19494082 (patch)
tree569cde081bd6b95759a394075519d813986c41a4 /generic/tkImgPhoto.c
parenta06b8b2fbacef3c034c5c1fde517efc84fd36712 (diff)
downloadtk-dcb1b688238afd4ac4b219aa0a63b4dd19494082.zip
tk-dcb1b688238afd4ac4b219aa0a63b4dd19494082.tar.gz
tk-dcb1b688238afd4ac4b219aa0a63b4dd19494082.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] FossilOrigin-Name: 084cb1a1e56a3f25b9468053816d6d1c86459696
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