diff options
| author | Gerd Moellmann | 2000-09-18 10:52:08 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-09-18 10:52:08 +0000 |
| commit | 28c7826c71a60f6a980d3064a449c51401d10b5b (patch) | |
| tree | 17fd79734e17fbd0fe5a47c3cde70ed600d518e5 /src | |
| parent | 2b612b1f55d36c88bee571f2b536153b7cb520a2 (diff) | |
| download | emacs-28c7826c71a60f6a980d3064a449c51401d10b5b.tar.gz emacs-28c7826c71a60f6a980d3064a449c51401d10b5b.zip | |
(lookup_image): Block input while loading the image so
that we won't get interrupted in a state where the image isn't yet
set up completely.
(xbm_load_image, xbm_load, xpm_load, xpm_load, lookup_rgb_color)
(lookup_pixel_color, x_to_xcolors, x_from_xcolors)
(x_disable_image, x_build_heuristic_mask, pbm_load, png_load)
(jpeg_load, tiff_load, gif_load, gs_load): Don't block/unblock
input.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/xfns.c | 82 |
2 files changed, 20 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 652aede7332..77d4d1161c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2000-09-18 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * xfns.c (lookup_image): Block input while loading the image so | ||
| 4 | that we won't get interrupted in a state where the image isn't yet | ||
| 5 | set up completely. | ||
| 6 | (xbm_load_image, xbm_load, xpm_load, xpm_load, lookup_rgb_color) | ||
| 7 | (lookup_pixel_color, x_to_xcolors, x_from_xcolors) | ||
| 8 | (x_disable_image, x_build_heuristic_mask, pbm_load, png_load) | ||
| 9 | (jpeg_load, tiff_load, gif_load, gs_load): Don't block/unblock | ||
| 10 | input. | ||
| 11 | |||
| 1 | 2000-09-16 Gerd Moellmann <gerd@gnu.org> | 12 | 2000-09-16 Gerd Moellmann <gerd@gnu.org> |
| 2 | 13 | ||
| 3 | * dispnew.c (update_window): Make sure to make desired rows | 14 | * dispnew.c (update_window): Make sure to make desired rows |
| @@ -17,7 +28,7 @@ | |||
| 17 | * xdisp.c (build_desired_tool_bar_string): For a toolbar item in | 28 | * xdisp.c (build_desired_tool_bar_string): For a toolbar item in |
| 18 | disabled state, don't apply an image transformation algorithm if | 29 | disabled state, don't apply an image transformation algorithm if |
| 19 | the user specified an image for the disabled state. Use | 30 | the user specified an image for the disabled state. Use |
| 20 | `:algorthm disabled' for creating a disabled item's image if the | 31 | `:algorithm disabled' for creating a disabled item's image if the |
| 21 | user hasn't specified an image. | 32 | user hasn't specified an image. |
| 22 | 33 | ||
| 23 | * xfns.c (ALLOC_XPM_COLORS): Define if we can use Emacs' color | 34 | * xfns.c (ALLOC_XPM_COLORS): Define if we can use Emacs' color |
diff --git a/src/xfns.c b/src/xfns.c index e57d223ea62..9a171965b16 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5738,10 +5738,10 @@ lookup_image (f, spec) | |||
| 5738 | /* If not found, create a new image and cache it. */ | 5738 | /* If not found, create a new image and cache it. */ |
| 5739 | if (img == NULL) | 5739 | if (img == NULL) |
| 5740 | { | 5740 | { |
| 5741 | BLOCK_INPUT; | ||
| 5741 | img = make_image (spec, hash); | 5742 | img = make_image (spec, hash); |
| 5742 | cache_image (f, img); | 5743 | cache_image (f, img); |
| 5743 | img->load_failed_p = img->type->load (f, img) == 0; | 5744 | img->load_failed_p = img->type->load (f, img) == 0; |
| 5744 | xassert (!interrupt_input_blocked); | ||
| 5745 | 5745 | ||
| 5746 | /* If we can't load the image, and we don't have a width and | 5746 | /* If we can't load the image, and we don't have a width and |
| 5747 | height, use some arbitrary width and height so that we can | 5747 | height, use some arbitrary width and height so that we can |
| @@ -5817,10 +5817,8 @@ lookup_image (f, spec) | |||
| 5817 | } | 5817 | } |
| 5818 | else if (NILP (mask) && found_p && img->mask) | 5818 | else if (NILP (mask) && found_p && img->mask) |
| 5819 | { | 5819 | { |
| 5820 | BLOCK_INPUT; | ||
| 5821 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); | 5820 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
| 5822 | img->mask = 0; | 5821 | img->mask = 0; |
| 5823 | UNBLOCK_INPUT; | ||
| 5824 | } | 5822 | } |
| 5825 | } | 5823 | } |
| 5826 | } | 5824 | } |
| @@ -5850,6 +5848,9 @@ lookup_image (f, spec) | |||
| 5850 | } | 5848 | } |
| 5851 | 5849 | ||
| 5852 | } | 5850 | } |
| 5851 | |||
| 5852 | UNBLOCK_INPUT; | ||
| 5853 | xassert (!interrupt_input_blocked); | ||
| 5853 | } | 5854 | } |
| 5854 | 5855 | ||
| 5855 | /* We're using IMG, so set its timestamp to `now'. */ | 5856 | /* We're using IMG, so set its timestamp to `now'. */ |
| @@ -6546,7 +6547,6 @@ xbm_load_image (f, img, contents, end) | |||
| 6546 | if (!NILP (value)) | 6547 | if (!NILP (value)) |
| 6547 | background = x_alloc_image_color (f, img, value, background); | 6548 | background = x_alloc_image_color (f, img, value, background); |
| 6548 | 6549 | ||
| 6549 | BLOCK_INPUT; | ||
| 6550 | img->pixmap | 6550 | img->pixmap |
| 6551 | = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), | 6551 | = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), |
| 6552 | FRAME_X_WINDOW (f), | 6552 | FRAME_X_WINDOW (f), |
| @@ -6563,8 +6563,6 @@ xbm_load_image (f, img, contents, end) | |||
| 6563 | } | 6563 | } |
| 6564 | else | 6564 | else |
| 6565 | success_p = 1; | 6565 | success_p = 1; |
| 6566 | |||
| 6567 | UNBLOCK_INPUT; | ||
| 6568 | } | 6566 | } |
| 6569 | else | 6567 | else |
| 6570 | image_error ("Error loading XBM image `%s'", img->spec, Qnil); | 6568 | image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
| @@ -6659,8 +6657,6 @@ xbm_load (f, img) | |||
| 6659 | xassert (img->width > 0 && img->height > 0); | 6657 | xassert (img->width > 0 && img->height > 0); |
| 6660 | } | 6658 | } |
| 6661 | 6659 | ||
| 6662 | BLOCK_INPUT; | ||
| 6663 | |||
| 6664 | /* Get foreground and background colors, maybe allocate colors. */ | 6660 | /* Get foreground and background colors, maybe allocate colors. */ |
| 6665 | if (fmt[XBM_FOREGROUND].count) | 6661 | if (fmt[XBM_FOREGROUND].count) |
| 6666 | foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, | 6662 | foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, |
| @@ -6714,8 +6710,6 @@ xbm_load (f, img) | |||
| 6714 | x_clear_image (f, img); | 6710 | x_clear_image (f, img); |
| 6715 | } | 6711 | } |
| 6716 | } | 6712 | } |
| 6717 | |||
| 6718 | UNBLOCK_INPUT; | ||
| 6719 | } | 6713 | } |
| 6720 | 6714 | ||
| 6721 | return success_p; | 6715 | return success_p; |
| @@ -7052,8 +7046,6 @@ xpm_load (f, img) | |||
| 7052 | 7046 | ||
| 7053 | /* Create a pixmap for the image, either from a file, or from a | 7047 | /* Create a pixmap for the image, either from a file, or from a |
| 7054 | string buffer containing data in the same format as an XPM file. */ | 7048 | string buffer containing data in the same format as an XPM file. */ |
| 7055 | BLOCK_INPUT; | ||
| 7056 | |||
| 7057 | #ifdef ALLOC_XPM_COLORS | 7049 | #ifdef ALLOC_XPM_COLORS |
| 7058 | xpm_init_color_cache (); | 7050 | xpm_init_color_cache (); |
| 7059 | #endif | 7051 | #endif |
| @@ -7065,7 +7057,6 @@ xpm_load (f, img) | |||
| 7065 | if (!STRINGP (file)) | 7057 | if (!STRINGP (file)) |
| 7066 | { | 7058 | { |
| 7067 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 7059 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 7068 | UNBLOCK_INPUT; | ||
| 7069 | return 0; | 7060 | return 0; |
| 7070 | } | 7061 | } |
| 7071 | 7062 | ||
| @@ -7081,7 +7072,6 @@ xpm_load (f, img) | |||
| 7081 | &img->pixmap, &img->mask, | 7072 | &img->pixmap, &img->mask, |
| 7082 | &attrs); | 7073 | &attrs); |
| 7083 | } | 7074 | } |
| 7084 | UNBLOCK_INPUT; | ||
| 7085 | 7075 | ||
| 7086 | if (rc == XpmSuccess) | 7076 | if (rc == XpmSuccess) |
| 7087 | { | 7077 | { |
| @@ -7105,9 +7095,7 @@ xpm_load (f, img) | |||
| 7105 | xassert (img->width > 0 && img->height > 0); | 7095 | xassert (img->width > 0 && img->height > 0); |
| 7106 | 7096 | ||
| 7107 | /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ | 7097 | /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ |
| 7108 | BLOCK_INPUT; | ||
| 7109 | XpmFreeAttributes (&attrs); | 7098 | XpmFreeAttributes (&attrs); |
| 7110 | UNBLOCK_INPUT; | ||
| 7111 | } | 7099 | } |
| 7112 | else | 7100 | else |
| 7113 | { | 7101 | { |
| @@ -7235,10 +7223,8 @@ lookup_rgb_color (f, r, g, b) | |||
| 7235 | color.green = g; | 7223 | color.green = g; |
| 7236 | color.blue = b; | 7224 | color.blue = b; |
| 7237 | 7225 | ||
| 7238 | BLOCK_INPUT; | ||
| 7239 | cmap = FRAME_X_COLORMAP (f); | 7226 | cmap = FRAME_X_COLORMAP (f); |
| 7240 | rc = x_alloc_nearest_color (f, cmap, &color); | 7227 | rc = x_alloc_nearest_color (f, cmap, &color); |
| 7241 | UNBLOCK_INPUT; | ||
| 7242 | 7228 | ||
| 7243 | if (rc) | 7229 | if (rc) |
| 7244 | { | 7230 | { |
| @@ -7281,13 +7267,10 @@ lookup_pixel_color (f, pixel) | |||
| 7281 | Colormap cmap; | 7267 | Colormap cmap; |
| 7282 | int rc; | 7268 | int rc; |
| 7283 | 7269 | ||
| 7284 | BLOCK_INPUT; | ||
| 7285 | |||
| 7286 | cmap = FRAME_X_COLORMAP (f); | 7270 | cmap = FRAME_X_COLORMAP (f); |
| 7287 | color.pixel = pixel; | 7271 | color.pixel = pixel; |
| 7288 | XQueryColor (FRAME_X_DISPLAY (f), cmap, &color); | 7272 | XQueryColor (FRAME_X_DISPLAY (f), cmap, &color); |
| 7289 | rc = x_alloc_nearest_color (f, cmap, &color); | 7273 | rc = x_alloc_nearest_color (f, cmap, &color); |
| 7290 | UNBLOCK_INPUT; | ||
| 7291 | 7274 | ||
| 7292 | if (rc) | 7275 | if (rc) |
| 7293 | { | 7276 | { |
| @@ -7397,8 +7380,6 @@ x_to_xcolors (f, img, rgb_p) | |||
| 7397 | XColor *colors, *p; | 7380 | XColor *colors, *p; |
| 7398 | XImage *ximg; | 7381 | XImage *ximg; |
| 7399 | 7382 | ||
| 7400 | BLOCK_INPUT; | ||
| 7401 | |||
| 7402 | colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors); | 7383 | colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors); |
| 7403 | 7384 | ||
| 7404 | /* Get the X image IMG->pixmap. */ | 7385 | /* Get the X image IMG->pixmap. */ |
| @@ -7421,8 +7402,6 @@ x_to_xcolors (f, img, rgb_p) | |||
| 7421 | } | 7402 | } |
| 7422 | 7403 | ||
| 7423 | XDestroyImage (ximg); | 7404 | XDestroyImage (ximg); |
| 7424 | |||
| 7425 | UNBLOCK_INPUT; | ||
| 7426 | return colors; | 7405 | return colors; |
| 7427 | } | 7406 | } |
| 7428 | 7407 | ||
| @@ -7442,7 +7421,6 @@ x_from_xcolors (f, img, colors) | |||
| 7442 | Pixmap pixmap; | 7421 | Pixmap pixmap; |
| 7443 | XColor *p; | 7422 | XColor *p; |
| 7444 | 7423 | ||
| 7445 | BLOCK_INPUT; | ||
| 7446 | init_color_table (); | 7424 | init_color_table (); |
| 7447 | 7425 | ||
| 7448 | x_create_x_image_and_pixmap (f, img->width, img->height, 0, | 7426 | x_create_x_image_and_pixmap (f, img->width, img->height, 0, |
| @@ -7464,7 +7442,6 @@ x_from_xcolors (f, img, colors) | |||
| 7464 | img->pixmap = pixmap; | 7442 | img->pixmap = pixmap; |
| 7465 | img->colors = colors_in_color_table (&img->ncolors); | 7443 | img->colors = colors_in_color_table (&img->ncolors); |
| 7466 | free_color_table (); | 7444 | free_color_table (); |
| 7467 | UNBLOCK_INPUT; | ||
| 7468 | } | 7445 | } |
| 7469 | 7446 | ||
| 7470 | 7447 | ||
| @@ -7645,7 +7622,6 @@ x_disable_image (f, img) | |||
| 7645 | Display *dpy = FRAME_X_DISPLAY (f); | 7622 | Display *dpy = FRAME_X_DISPLAY (f); |
| 7646 | GC gc; | 7623 | GC gc; |
| 7647 | 7624 | ||
| 7648 | BLOCK_INPUT; | ||
| 7649 | gc = XCreateGC (dpy, img->pixmap, 0, NULL); | 7625 | gc = XCreateGC (dpy, img->pixmap, 0, NULL); |
| 7650 | XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); | 7626 | XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); |
| 7651 | XDrawLine (dpy, img->pixmap, gc, 0, 0, | 7627 | XDrawLine (dpy, img->pixmap, gc, 0, 0, |
| @@ -7664,8 +7640,6 @@ x_disable_image (f, img) | |||
| 7664 | img->width - 1, 0); | 7640 | img->width - 1, 0); |
| 7665 | XFreeGC (dpy, gc); | 7641 | XFreeGC (dpy, gc); |
| 7666 | } | 7642 | } |
| 7667 | |||
| 7668 | UNBLOCK_INPUT; | ||
| 7669 | } | 7643 | } |
| 7670 | } | 7644 | } |
| 7671 | 7645 | ||
| @@ -7688,8 +7662,6 @@ x_build_heuristic_mask (f, img, how) | |||
| 7688 | int x, y, rc, look_at_corners_p; | 7662 | int x, y, rc, look_at_corners_p; |
| 7689 | unsigned long bg = 0; | 7663 | unsigned long bg = 0; |
| 7690 | 7664 | ||
| 7691 | BLOCK_INPUT; | ||
| 7692 | |||
| 7693 | if (img->mask) | 7665 | if (img->mask) |
| 7694 | { | 7666 | { |
| 7695 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); | 7667 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
| @@ -7700,10 +7672,7 @@ x_build_heuristic_mask (f, img, how) | |||
| 7700 | rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, | 7672 | rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, |
| 7701 | &mask_img, &img->mask); | 7673 | &mask_img, &img->mask); |
| 7702 | if (!rc) | 7674 | if (!rc) |
| 7703 | { | 7675 | return 0; |
| 7704 | UNBLOCK_INPUT; | ||
| 7705 | return 0; | ||
| 7706 | } | ||
| 7707 | 7676 | ||
| 7708 | /* Get the X image of IMG->pixmap. */ | 7677 | /* Get the X image of IMG->pixmap. */ |
| 7709 | ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height, | 7678 | ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height, |
| @@ -7779,7 +7748,6 @@ x_build_heuristic_mask (f, img, how) | |||
| 7779 | x_destroy_x_image (mask_img); | 7748 | x_destroy_x_image (mask_img); |
| 7780 | XDestroyImage (ximg); | 7749 | XDestroyImage (ximg); |
| 7781 | 7750 | ||
| 7782 | UNBLOCK_INPUT; | ||
| 7783 | return 1; | 7751 | return 1; |
| 7784 | } | 7752 | } |
| 7785 | 7753 | ||
| @@ -8005,13 +7973,9 @@ pbm_load (f, img) | |||
| 8005 | || (type != PBM_MONO && max_color_idx < 0)) | 7973 | || (type != PBM_MONO && max_color_idx < 0)) |
| 8006 | goto error; | 7974 | goto error; |
| 8007 | 7975 | ||
| 8008 | BLOCK_INPUT; | ||
| 8009 | if (!x_create_x_image_and_pixmap (f, width, height, 0, | 7976 | if (!x_create_x_image_and_pixmap (f, width, height, 0, |
| 8010 | &ximg, &img->pixmap)) | 7977 | &ximg, &img->pixmap)) |
| 8011 | { | 7978 | goto error; |
| 8012 | UNBLOCK_INPUT; | ||
| 8013 | goto error; | ||
| 8014 | } | ||
| 8015 | 7979 | ||
| 8016 | /* Initialize the color hash table. */ | 7980 | /* Initialize the color hash table. */ |
| 8017 | init_color_table (); | 7981 | init_color_table (); |
| @@ -8065,7 +8029,6 @@ pbm_load (f, img) | |||
| 8065 | xfree (ximg->data); | 8029 | xfree (ximg->data); |
| 8066 | ximg->data = NULL; | 8030 | ximg->data = NULL; |
| 8067 | XDestroyImage (ximg); | 8031 | XDestroyImage (ximg); |
| 8068 | UNBLOCK_INPUT; | ||
| 8069 | image_error ("Invalid pixel value in image `%s'", | 8032 | image_error ("Invalid pixel value in image `%s'", |
| 8070 | img->spec, Qnil); | 8033 | img->spec, Qnil); |
| 8071 | goto error; | 8034 | goto error; |
| @@ -8088,7 +8051,6 @@ pbm_load (f, img) | |||
| 8088 | /* Put the image into a pixmap. */ | 8051 | /* Put the image into a pixmap. */ |
| 8089 | x_put_x_image (f, ximg, img->pixmap, width, height); | 8052 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 8090 | x_destroy_x_image (ximg); | 8053 | x_destroy_x_image (ximg); |
| 8091 | UNBLOCK_INPUT; | ||
| 8092 | 8054 | ||
| 8093 | img->width = width; | 8055 | img->width = width; |
| 8094 | img->height = height; | 8056 | img->height = height; |
| @@ -8433,11 +8395,9 @@ png_load (f, img) | |||
| 8433 | Colormap cmap; | 8395 | Colormap cmap; |
| 8434 | png_color_16 frame_background; | 8396 | png_color_16 frame_background; |
| 8435 | 8397 | ||
| 8436 | BLOCK_INPUT; | ||
| 8437 | cmap = FRAME_X_COLORMAP (f); | 8398 | cmap = FRAME_X_COLORMAP (f); |
| 8438 | color.pixel = FRAME_BACKGROUND_PIXEL (f); | 8399 | color.pixel = FRAME_BACKGROUND_PIXEL (f); |
| 8439 | XQueryColor (FRAME_X_DISPLAY (f), cmap, &color); | 8400 | XQueryColor (FRAME_X_DISPLAY (f), cmap, &color); |
| 8440 | UNBLOCK_INPUT; | ||
| 8441 | 8401 | ||
| 8442 | bzero (&frame_background, sizeof frame_background); | 8402 | bzero (&frame_background, sizeof frame_background); |
| 8443 | frame_background.red = color.red; | 8403 | frame_background.red = color.red; |
| @@ -8478,15 +8438,10 @@ png_load (f, img) | |||
| 8478 | fp = NULL; | 8438 | fp = NULL; |
| 8479 | } | 8439 | } |
| 8480 | 8440 | ||
| 8481 | BLOCK_INPUT; | ||
| 8482 | |||
| 8483 | /* Create the X image and pixmap. */ | 8441 | /* Create the X image and pixmap. */ |
| 8484 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, | 8442 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
| 8485 | &img->pixmap)) | 8443 | &img->pixmap)) |
| 8486 | { | 8444 | goto error; |
| 8487 | UNBLOCK_INPUT; | ||
| 8488 | goto error; | ||
| 8489 | } | ||
| 8490 | 8445 | ||
| 8491 | /* Create an image and pixmap serving as mask if the PNG image | 8446 | /* Create an image and pixmap serving as mask if the PNG image |
| 8492 | contains an alpha channel. */ | 8447 | contains an alpha channel. */ |
| @@ -8498,7 +8453,6 @@ png_load (f, img) | |||
| 8498 | x_destroy_x_image (ximg); | 8453 | x_destroy_x_image (ximg); |
| 8499 | XFreePixmap (FRAME_X_DISPLAY (f), img->pixmap); | 8454 | XFreePixmap (FRAME_X_DISPLAY (f), img->pixmap); |
| 8500 | img->pixmap = 0; | 8455 | img->pixmap = 0; |
| 8501 | UNBLOCK_INPUT; | ||
| 8502 | goto error; | 8456 | goto error; |
| 8503 | } | 8457 | } |
| 8504 | 8458 | ||
| @@ -8566,7 +8520,6 @@ png_load (f, img) | |||
| 8566 | x_destroy_x_image (mask_img); | 8520 | x_destroy_x_image (mask_img); |
| 8567 | } | 8521 | } |
| 8568 | 8522 | ||
| 8569 | UNBLOCK_INPUT; | ||
| 8570 | UNGCPRO; | 8523 | UNGCPRO; |
| 8571 | return 1; | 8524 | return 1; |
| 8572 | } | 8525 | } |
| @@ -8844,15 +8797,12 @@ jpeg_load (f, img) | |||
| 8844 | fclose ((FILE *) fp); | 8797 | fclose ((FILE *) fp); |
| 8845 | jpeg_destroy_decompress (&cinfo); | 8798 | jpeg_destroy_decompress (&cinfo); |
| 8846 | 8799 | ||
| 8847 | BLOCK_INPUT; | ||
| 8848 | |||
| 8849 | /* If we already have an XImage, free that. */ | 8800 | /* If we already have an XImage, free that. */ |
| 8850 | x_destroy_x_image (ximg); | 8801 | x_destroy_x_image (ximg); |
| 8851 | 8802 | ||
| 8852 | /* Free pixmap and colors. */ | 8803 | /* Free pixmap and colors. */ |
| 8853 | x_clear_image (f, img); | 8804 | x_clear_image (f, img); |
| 8854 | 8805 | ||
| 8855 | UNBLOCK_INPUT; | ||
| 8856 | UNGCPRO; | 8806 | UNGCPRO; |
| 8857 | return 0; | 8807 | return 0; |
| 8858 | } | 8808 | } |
| @@ -8876,14 +8826,9 @@ jpeg_load (f, img) | |||
| 8876 | width = img->width = cinfo.output_width; | 8826 | width = img->width = cinfo.output_width; |
| 8877 | height = img->height = cinfo.output_height; | 8827 | height = img->height = cinfo.output_height; |
| 8878 | 8828 | ||
| 8879 | BLOCK_INPUT; | ||
| 8880 | |||
| 8881 | /* Create X image and pixmap. */ | 8829 | /* Create X image and pixmap. */ |
| 8882 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 8830 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| 8883 | { | 8831 | longjmp (mgr.setjmp_buffer, 2); |
| 8884 | UNBLOCK_INPUT; | ||
| 8885 | longjmp (mgr.setjmp_buffer, 2); | ||
| 8886 | } | ||
| 8887 | 8832 | ||
| 8888 | /* Allocate colors. When color quantization is used, | 8833 | /* Allocate colors. When color quantization is used, |
| 8889 | cinfo.actual_number_of_colors has been set with the number of | 8834 | cinfo.actual_number_of_colors has been set with the number of |
| @@ -8943,7 +8888,6 @@ jpeg_load (f, img) | |||
| 8943 | /* Put the image into the pixmap. */ | 8888 | /* Put the image into the pixmap. */ |
| 8944 | x_put_x_image (f, ximg, img->pixmap, width, height); | 8889 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 8945 | x_destroy_x_image (ximg); | 8890 | x_destroy_x_image (ximg); |
| 8946 | UNBLOCK_INPUT; | ||
| 8947 | UNGCPRO; | 8891 | UNGCPRO; |
| 8948 | return 1; | 8892 | return 1; |
| 8949 | } | 8893 | } |
| @@ -9228,12 +9172,9 @@ tiff_load (f, img) | |||
| 9228 | return 0; | 9172 | return 0; |
| 9229 | } | 9173 | } |
| 9230 | 9174 | ||
| 9231 | BLOCK_INPUT; | ||
| 9232 | |||
| 9233 | /* Create the X image and pixmap. */ | 9175 | /* Create the X image and pixmap. */ |
| 9234 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 9176 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| 9235 | { | 9177 | { |
| 9236 | UNBLOCK_INPUT; | ||
| 9237 | xfree (buf); | 9178 | xfree (buf); |
| 9238 | UNGCPRO; | 9179 | UNGCPRO; |
| 9239 | return 0; | 9180 | return 0; |
| @@ -9265,7 +9206,6 @@ tiff_load (f, img) | |||
| 9265 | x_put_x_image (f, ximg, img->pixmap, width, height); | 9206 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 9266 | x_destroy_x_image (ximg); | 9207 | x_destroy_x_image (ximg); |
| 9267 | xfree (buf); | 9208 | xfree (buf); |
| 9268 | UNBLOCK_INPUT; | ||
| 9269 | 9209 | ||
| 9270 | img->width = width; | 9210 | img->width = width; |
| 9271 | img->height = height; | 9211 | img->height = height; |
| @@ -9476,12 +9416,9 @@ gif_load (f, img) | |||
| 9476 | width = img->width = gif->SWidth; | 9416 | width = img->width = gif->SWidth; |
| 9477 | height = img->height = gif->SHeight; | 9417 | height = img->height = gif->SHeight; |
| 9478 | 9418 | ||
| 9479 | BLOCK_INPUT; | ||
| 9480 | |||
| 9481 | /* Create the X image and pixmap. */ | 9419 | /* Create the X image and pixmap. */ |
| 9482 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 9420 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| 9483 | { | 9421 | { |
| 9484 | UNBLOCK_INPUT; | ||
| 9485 | DGifCloseFile (gif); | 9422 | DGifCloseFile (gif); |
| 9486 | UNGCPRO; | 9423 | UNGCPRO; |
| 9487 | return 0; | 9424 | return 0; |
| @@ -9579,7 +9516,6 @@ gif_load (f, img) | |||
| 9579 | /* Put the image into the pixmap, then free the X image and its buffer. */ | 9516 | /* Put the image into the pixmap, then free the X image and its buffer. */ |
| 9580 | x_put_x_image (f, ximg, img->pixmap, width, height); | 9517 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 9581 | x_destroy_x_image (ximg); | 9518 | x_destroy_x_image (ximg); |
| 9582 | UNBLOCK_INPUT; | ||
| 9583 | 9519 | ||
| 9584 | UNGCPRO; | 9520 | UNGCPRO; |
| 9585 | return 1; | 9521 | return 1; |
| @@ -9736,12 +9672,10 @@ gs_load (f, img) | |||
| 9736 | img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy; | 9672 | img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy; |
| 9737 | 9673 | ||
| 9738 | /* Create the pixmap. */ | 9674 | /* Create the pixmap. */ |
| 9739 | BLOCK_INPUT; | ||
| 9740 | xassert (img->pixmap == 0); | 9675 | xassert (img->pixmap == 0); |
| 9741 | img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 9676 | img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 9742 | img->width, img->height, | 9677 | img->width, img->height, |
| 9743 | DefaultDepthOfScreen (FRAME_X_SCREEN (f))); | 9678 | DefaultDepthOfScreen (FRAME_X_SCREEN (f))); |
| 9744 | UNBLOCK_INPUT; | ||
| 9745 | 9679 | ||
| 9746 | if (!img->pixmap) | 9680 | if (!img->pixmap) |
| 9747 | { | 9681 | { |