# HG changeset patch # User didierv # Date 1194274764 0 # Node ID 8475ff9c49ea2a6fddceee098c4e3ce4393a85b4 # Parent b45f331a659debb03da20ff542c7e194ab1650f5 [xemacs-hg @ 2007-11-05 14:59:20 by didierv] Fix recent image related crashes diff -r b45f331a659d -r 8475ff9c49ea src/ChangeLog --- a/src/ChangeLog Sun Nov 04 22:50:59 2007 +0000 +++ b/src/ChangeLog Mon Nov 05 14:59:24 2007 +0000 @@ -1,16 +1,27 @@ +2007-11-05 Didier Verna + + * glyphs.c (potential_pixmap_file_instanciator): Fix comment + describing its behavior. + * glyphs.c (xbm_mask_file_munging): Update semantics of file and + mask_file arguments to reflect recent changes in + potential_pixmap_file_instanciator (see patch below). + * glyphs-x.c (autodetect_normalize): Update call to + xbm_mask_file_munging to reflect the above change. + * glyphs-gtk.c (autodetect_normalize): Ditto. + 2007-10-10 Didier Verna - * glyphs.c (potential_pixmap_file_instantiator): Make a difference - between not being able to locate a pixmap file, and not having a - console method to do so. - * glyphs.c (simple_image_type_normalize): Notice that difference, - and don't err when the method is unavailable. - * glyphs.c (xbm_normalize): Ditto. - * glyphs.c (xface_normalize): Ditto. - * glyphs.c (xpm_normalize): Ditto. - * glyphs-shared.c (shared_resource_normalize): Ditto. - * glyphs-x.c (x_locate_pixmap_file): Recognize ~ pathnames as - fully qualified. + * glyphs.c (potential_pixmap_file_instantiator): Make a difference + between not being able to locate a pixmap file, and not having a + console method to do so. + * glyphs.c (simple_image_type_normalize): Notice that difference, + and don't err when the method is unavailable. + * glyphs.c (xbm_normalize): Ditto. + * glyphs.c (xface_normalize): Ditto. + * glyphs.c (xpm_normalize): Ditto. + * glyphs-shared.c (shared_resource_normalize): Ditto. + * glyphs-x.c (x_locate_pixmap_file): Recognize ~ pathnames as + fully qualified. 2007-10-03 Didier Verna diff -r b45f331a659d -r 8475ff9c49ea src/glyphs-gtk.c --- a/src/glyphs-gtk.c Sun Nov 04 22:50:59 2007 +0000 +++ b/src/glyphs-gtk.c Mon Nov 05 14:59:24 2007 +0000 @@ -162,7 +162,7 @@ /************************************************************************/ /* convert from a series of RGB triples to an XImage formated for the */ -/* proper display */ +/* proper display */ /************************************************************************/ static GdkImage * convert_EImage_to_GDKImage (Lisp_Object device, int width, int height, @@ -215,7 +215,7 @@ gdk_image_destroy (outimg); return NULL; } - + if (vis->type == GDK_VISUAL_PSEUDO_COLOR) { unsigned long pixarray[256]; @@ -231,7 +231,7 @@ { GdkColor color; int res; - + color.red = qtable->rm[i] ? qtable->rm[i] << 8 : 0; color.green = qtable->gm[i] ? qtable->gm[i] << 8 : 0; color.blue = qtable->bm[i] ? qtable->bm[i] << 8 : 0; @@ -343,7 +343,7 @@ #endif } } - } + } return outimg; } @@ -885,7 +885,7 @@ gtk_init_image_instance_from_eimage (struct Lisp_Image_Instance *ii, int width, int height, int slices, - unsigned char *eimage, + unsigned char *eimage, int dest_mask, Lisp_Object instantiator, Lisp_Object pointer_fg, @@ -1168,13 +1168,13 @@ Fmake_color_instance (value, device, encode_error_behavior_flag (ERROR_ME_DEBUG_WARN)); else - { - assert (COLOR_SPECIFIERP (value)); - value = Fspecifier_instance (value, domain, Qnil, Qnil); - } + { + assert (COLOR_SPECIFIERP (value)); + value = Fspecifier_instance (value, domain, Qnil, Qnil); + } if (NILP (value)) - continue; + continue; results = noseeum_cons (noseeum_cons (name, value), results); i++; } @@ -1188,7 +1188,7 @@ for (j=0; j= 1; len -= 2) { /* Keyword comparisons can be done with eq, the value must be - done with equal. - #### Note that this does not optimize re-ordering. */ + done with equal. + #### Note that this does not optimize re-ordering. */ if (!EQ (elt[len], old_elt[len]) || !internal_equal (elt[len+1], old_elt[len+1], 0)) alist = Fcons (Fcons (elt[len], elt[len+1]), alist); @@ -914,7 +914,7 @@ { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, name) }, { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, parent) }, { XD_LISP_OBJECT, offsetof (Lisp_Image_Instance, instantiator) }, - { XD_UNION, offsetof (struct Lisp_Image_Instance, u), + { XD_UNION, offsetof (struct Lisp_Image_Instance, u), XD_INDIRECT (0, 0), { &image_instance_data_description } }, { XD_END } }; @@ -993,7 +993,7 @@ if (print_readably) printing_unreadable_object ("#", - ii->header.uid); + ii->header.uid); write_fmt_string_lisp (printcharfun, "#name)) @@ -1095,7 +1095,7 @@ write_c_string (printcharfun, "dead"); else write_c_string (printcharfun, - DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); + DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); } write_c_string (printcharfun, "-frame>"); write_fmt_string (printcharfun, " 0x%p", @@ -1293,7 +1293,7 @@ case IMAGE_WIDGET: /* We need the hash to be equivalent to what should be - displayed. */ + displayed. */ hash = HASH5 (hash, LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)), internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1), @@ -2236,7 +2236,7 @@ Lisp_Object data) { signal_error_1 (Qimage_conversion_error, - list3 (build_msg_string (string1), + list3 (build_msg_string (string1), build_msg_string (string2), data)); } @@ -2246,7 +2246,7 @@ Lisp_Object data1, Lisp_Object data2) { signal_error_1 (Qimage_conversion_error, - list4 (build_msg_string (string1), + list4 (build_msg_string (string1), build_msg_string (string2), data1, data2)); } @@ -2530,9 +2530,10 @@ /* pixmap file functions */ /************************************************************************/ -/* If INSTANTIATOR refers to inline data, return Qnil. +/* If INSTANTIATOR refers to inline data, return Qt. If INSTANTIATOR refers to data in a file, return the full filename - if it exists; otherwise, return a cons of (filename). + if it exists, Qnil if there's no console method for locating the file, or + (filename) if there was an error locating the file. FILE_KEYWORD and DATA_KEYWORD are symbols specifying the keywords used to look up the file and inline data, @@ -2556,21 +2557,21 @@ if (!NILP (file) && NILP (data)) { struct console_methods *meths - = decode_console_type(console_type, ERROR_ME); + = decode_console_type(console_type, ERROR_ME); if (HAS_CONTYPE_METH_P (meths, locate_pixmap_file)) - { - Lisp_Object retval - = CONTYPE_METH (meths, locate_pixmap_file, (file)); - - if (!NILP (retval)) - return retval; - else - return Fcons (file, Qnil); /* should have been file */ + { + Lisp_Object retval + = CONTYPE_METH (meths, locate_pixmap_file, (file)); + + if (!NILP (retval)) + return retval; + else + return Fcons (file, Qnil); /* should have been file */ + } + else /* method unavailable */ + return Qnil; } - else /* method unavailable */ - return Qnil; -} return Qt; } @@ -2751,10 +2752,10 @@ /* This is unclean but it's fairly standard -- a number of the bitmaps in /usr/include/X11/bitmaps use it -- so we support it. */ - if (NILP (mask_file) + if (EQ (mask_file, Qt) /* don't override explicitly specified mask data. */ && NILP (assq_no_quit (Q_mask_data, alist)) - && !NILP (file)) + && !EQ (file, Qt)) { mask_file = MAYBE_LISP_CONTYPE_METH (decode_console_type(console_type, ERROR_ME), @@ -2834,7 +2835,6 @@ alist); } - /* #### FIXME: Hmmm... what about mask being Qt ?? -- dvl */ alist = xbm_mask_file_munging (alist, file, mask_file, console_type); { @@ -2904,11 +2904,11 @@ if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ RETURN_UNGCPRO (inst); - - /* #### FIXME: and what about file / mask being Qt ? -- dvl */ alist = tagged_vector_to_alist (inst); { + /* #### FIXME: what if EQ (file, Qt) && !EQ (mask, Qt) ? Is that possible? + If so, we have a problem... -- dvl */ Lisp_Object data = make_string_from_file (file); alist = remassq_no_quit (Q_file, alist); /* there can't be a :data at this point. */ @@ -3382,7 +3382,7 @@ ABORT (); /* We're not allowed anything else currently. */ /* If we don't have an instance at this point then create - one. */ + one. */ if (UNBOUNDP (instance)) { Lisp_Object locative = @@ -3429,12 +3429,12 @@ else if (NILP (instance)) gui_error ("Can't instantiate image (probably cached)", instantiator); /* We found an instance. However, because we are using the glyph - as the hash key instead of the instantiator, the current - instantiator may not be the same as the original. Thus we - must update the instance based on the new - instantiator. Preserving instance identity like this is - important to stop excessive window system widget creation and - deletion - and hence flashing. */ + as the hash key instead of the instantiator, the current + instantiator may not be the same as the original. Thus we + must update the instance based on the new + instantiator. Preserving instance identity like this is + important to stop excessive window system widget creation and + deletion - and hence flashing. */ else { /* #### This function should be able to cope with *all* @@ -4284,7 +4284,7 @@ /***************************************************************************** - * glyph cachel functions * + * glyph cachel functions * *****************************************************************************/ /* #### All of this is 95% copied from face cachels. Consider @@ -4457,7 +4457,7 @@ /***************************************************************************** - * subwindow cachel functions * + * subwindow cachel functions * *****************************************************************************/ /* Subwindows are curious in that you have to physically unmap them to not display them. It is problematic deciding what to do in @@ -4825,7 +4825,7 @@ register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii), IMAGE_INSTANCE_DISPLAY_Y (ii), IMAGE_INSTANCE_DISPLAY_WIDTH (ii), - IMAGE_INSTANCE_DISPLAY_HEIGHT (ii)); + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii)); IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)), @@ -5101,7 +5101,7 @@ { /* Increment the index of the image slice we are currently viewing. */ - IMAGE_INSTANCE_PIXMAP_SLICE (ii) = + IMAGE_INSTANCE_PIXMAP_SLICE (ii) = (IMAGE_INSTANCE_PIXMAP_SLICE (ii) + 1) % IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii); /* We might need to kick redisplay at this point - but we