changeset 12608:c6215ec3f536

(unload_color): Don't free colors if immutable colormap.
author Richard M. Stallman <rms@gnu.org>
date Wed, 19 Jul 1995 15:47:28 +0000
parents 498ce026e14b
children 5cb83d6bbce1
files src/xfaces.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Wed Jul 19 15:43:56 1995 +0000
+++ b/src/xfaces.c	Wed Jul 19 15:47:28 1995 +0000
@@ -363,14 +363,22 @@
 {
   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,