From xemacs-m  Tue Apr  8 01:35:24 1997
Received: from GS213.SP.CS.CMU.EDU (GS213.SP.CS.CMU.EDU [128.2.209.183])
	by xemacs.org (8.8.5/8.8.5) with SMTP id BAA22829
	for <xemacs-beta@xemacs.org>; Tue, 8 Apr 1997 01:35:24 -0500 (CDT)
Received: by GS213.SP.CS.CMU.EDU (AIX 3.2/UCB 5.64/4.03)
          id AA17778; Tue, 8 Apr 1997 02:35:21 -0400
Date: Tue, 8 Apr 1997 02:35:21 -0400
Message-Id: <9704080635.AA17778@GS213.SP.CS.CMU.EDU>
From: Darrell Kindred <dkindred@cmu.edu>
To: xemacs-beta@xemacs.org
Subject: 19.15: PATCH for multi-device core dump
Organization: Carnegie Mellon University School of Computer Science

The following causes a core dump in XEmacs 19.15 under all
OSes I've tried:

    xemacs -nw -q
    M-x make-frame-on-display myhost:0

(where myhost:0 is a valid display).  The problem is that
extract_xpm_color_names() instantiates specifiers using the
selected window (rather than the appropriate device) as the
domain.

The patch below fixes this.  Assuming the patch looks okay,
I think it would be good to include this in "official" patch
page:

   http://xemacs.cs.uiuc.edu/xemacs-19.15-patches/patch-page.html

Please feel free to forward this message to comp.xemacs if
that seems appropriate.

- Darrell

--- src/glyphs-x.c.orig	Tue Mar 25 23:34:39 1997
+++ src/glyphs-x.c	Mon Apr  7 23:50:53 1997
@@ -2587,7 +2587,7 @@
       else
         {
           assert (COLOR_SPECIFIERP (value));
-          value = Fspecifier_instance (value, Qnil, Qnil, Qnil);
+          value = Fspecifier_instance (value, device, Qnil, Qnil);
         }
       if (NILP (value))
         continue;
@@ -2606,7 +2606,10 @@
   while (--i >= 0)
     {
       Lisp_Object cons = XCAR (results);
-      color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (XCDR (cons)));
+      struct Lisp_Color_Instance *color_inst = XCOLOR_INSTANCE (XCDR (cons));
+
+      assert (color_inst->data != NULL);
+      color = COLOR_INSTANCE_X_COLOR (color_inst);
       /* Duplicate the pixel value so that we still have a lock on it if
 	 the pixel we were passed is later freed. */
       if (! XAllocColor (dpy, cmap, &color))

