summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-07-19 15:47:28 +0000
committerRichard M. Stallman <rms@gnu.org>1995-07-19 15:47:28 +0000
commit828e66d1a5d6e6a50d6fa207e29b2a6374bb81c8 (patch)
tree53a1770afc41c8527a6514159e23fe6b9db93e6a
parent6da74aab1545260205ba43e912e6a05ad33b4b95 (diff)
downloademacs-828e66d1a5d6e6a50d6fa207e29b2a6374bb81c8.tar.gz
emacs-828e66d1a5d6e6a50d6fa207e29b2a6374bb81c8.tar.bz2
emacs-828e66d1a5d6e6a50d6fa207e29b2a6374bb81c8.zip
(unload_color): Don't free colors if immutable colormap.
-rw-r--r--src/xfaces.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 8872b724810..59e09d95077 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -363,14 +363,22 @@ unload_color (f, pixel)
{
Colormap cmap;
Display *dpy = FRAME_X_DISPLAY (f);
+ int class = FRAME_X_DISPLAY_INFO (f)->visual->class;
+
if (pixel == FACE_DEFAULT
|| pixel == BLACK_PIX_DEFAULT (f)
|| pixel == WHITE_PIX_DEFAULT (f))
return;
cmap = DefaultColormapOfScreen (DefaultScreenOfDisplay (dpy));
- BLOCK_INPUT;
- XFreeColors (dpy, cmap, &pixel, 1, (unsigned long)0);
- UNBLOCK_INPUT;
+
+ /* If display has an immutable color map, freeing colors is not
+ necessary and some servers don't allow it. So don't do it. */
+ if (! (class == StaticColor || class == StaticGray || class == TrueColor))
+ {
+ BLOCK_INPUT;
+ XFreeColors (dpy, cmap, &pixel, 1, (unsigned long)0);
+ UNBLOCK_INPUT;
+ }
}
DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0,