| [ Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]
STR #2021
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 4 - High, e.g. key functionality not working |
Scope: | 2 - Specific to an operating system |
Subsystem: | X11 |
Summary: | Fix for XGetImage error in fl_read_image.cxx |
Version: | 1.1.9 |
Created By: | markcw |
Assigned To: | matt |
Fix Version: | 1.1.10 (SVN: v6475) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | markcw 17:50 Aug 12, 2008 |
| A fix added to fl_read_image.cxx not by me but by Sebastian Hollington. It fixes a crash that happened sometimes when an image was clicked on. It is tested in Ubuntu and is probably Linux-specific.
The error report was: X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 73 (X_GetImage)
The fix is shown below and the modified fl_read_image.cxx is attached. The file also includes a previous fix by Seb reported here: http://www.fltk.org/str.php?L2006
// Line 80 before fl_read_image()
// Used to catch (and ignore) any exceptions when calling XGetImage
static int xgetimageerrhandler(Display *display, XErrorEvent *error)
{return 0;}
// Line 138 in fl_read_image()
// screen dimensions
Fl::screen_xywh(sx, sy, sw, sh, fl_screen);
if (ww < sw) sw = --ww;
if (wh < sh) sh = --wh;
}
if (!win || (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh)) {
// the image is fully contained in the window, so we can try the traditional method,
// however, if the window is obscured etc. the function will still fail. Make sure we
// catch the error and continue, otherwise an exception will be thrown.
XErrorHandler old_handler = XSetErrorHandler(xgetimageerrhandler);
image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap);
XSetErrorHandler(old_handler);
}
if (!image){
// image is crossing borders, determine visible region | |
|
#2 | matt 13:36 Oct 19, 2008 |
| Fixed in 1.3 as well. Thanks for the patch! | |
[ Return to Bugs & Features ]
|
| |