Okay, I jumped the gun a bit with my last patch. Apply this one
instead and things should work fine.
1998-04-28 P. E. Jareth Hein <jareth(a)camelot-soft.com>
* glyphs-x.c : slight cleanup and bugfix related to memory
corruption and possible leaks. Also fix a visual problem
with XPM pointers
Index: glyphs-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/src/glyphs-x.c,v
retrieving revision 1.44
diff -u -r1.44 glyphs-x.c
--- glyphs-x.c 1998/04/28 00:24:58 1.44
+++ glyphs-x.c 1998/04/28 19:24:46
@@ -152,7 +152,7 @@
static XImage *
convert_EImage_to_XImage (Lisp_Object device, int width, int height,
unsigned char *pic, unsigned long **pixtbl,
- int *pixcount, int *npixels)
+ int *npixels)
{
Display *dpy;
Colormap cmap;
@@ -201,10 +201,10 @@
if (vis->class == PseudoColor)
{
unsigned long pixarray[256];
- int n;
+ int pixcount, n;
/* use our quantize table to allocate the colors */
- *pixcount = 32;
- *pixtbl = xnew_array (unsigned long, *pixcount);
+ pixcount = 32;
+ *pixtbl = xnew_array (unsigned long, pixcount);
*npixels = 0;
/* ### should implement a sort by popularity to assure proper allocation */
@@ -221,7 +221,7 @@
res = allocate_nearest_color (dpy, cmap, vis, &color);
if (res > 0 && res < 3)
{
- DO_REALLOC(*pixtbl, *pixcount, n+1, unsigned long);
+ DO_REALLOC(*pixtbl, pixcount, n+1, unsigned long);
(*pixtbl)[n] = color.pixel;
n++;
}
@@ -825,16 +825,18 @@
{
Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
Colormap cmap = DEVICE_X_COLORMAP (XDEVICE(device));
- unsigned long *pixtbl;
- int pixcount;
- int npixels;
+ unsigned long *pixtbl = NULL;
+ int npixels = 0;
XImage* ximage;
ximage = convert_EImage_to_XImage (device, width, height, eimage,
- &pixtbl, &pixcount, &npixels);
+ &pixtbl, &npixels);
if (!ximage)
- signal_image_error("EImage to XImage conversion failed", instantiator);
-
+ {
+ if (pixtbl) xfree (pixtbl);
+ signal_image_error("EImage to XImage conversion failed", instantiator);
+ }
+
/* Now create the pixmap and set up the image instance */
init_image_instance_from_x_image (ii, ximage, dest_mask,
cmap, pixtbl, npixels,
@@ -1523,6 +1525,7 @@
Screen *xs;
Colormap cmap;
int depth;
+ Visual *visual;
Pixmap pixmap;
Pixmap mask = 0;
XpmAttributes xpmattrs;
@@ -1554,22 +1557,23 @@
#if 1
/* Although I haven't found it documented yet, it appears that pointers are
- always colored via the default window colormap... Sigh. However, with
- the current color structure, this will blow the doors off as things aren't set
up
- to differenciate between two colormaps per console. AARGH! */
+ always colored via the default window colormap... Sigh. */
if (type == IMAGE_POINTER)
{
cmap = DefaultColormap(dpy, DefaultScreen(dpy));
depth = DefaultDepthOfScreen (xs);
+ visual = DefaultVisualOfScreen (xs);
}
else
{
cmap = DEVICE_X_COLORMAP (XDEVICE(device));
depth = DEVICE_X_DEPTH (XDEVICE(device));
+ visual = DEVICE_X_VISUAL (XDEVICE(device));
}
#else
cmap = DEVICE_X_COLORMAP (XDEVICE(device));
depth = DEVICE_X_DEPTH (XDEVICE(device));
+ visual = DEVICE_X_VISUAL (XDEVICE(device));
#endif
x_initialize_pixmap_image_instance (ii, type);
@@ -1596,7 +1600,7 @@
xpmattrs.valuemask |= XpmCloseness;
xpmattrs.depth = depth;
xpmattrs.valuemask |= XpmDepth;
- xpmattrs.visual = DEVICE_X_VISUAL (XDEVICE(device));
+ xpmattrs.visual = visual;
xpmattrs.valuemask |= XpmVisual;
xpmattrs.colormap = cmap;
xpmattrs.valuemask |= XpmColormap;
--
Jareth Hein | jareth(a)camelot-soft.com | ハイン ジェラス
Toolsmith & Program lead |
http://www.camelot-soft.com | 開発部チーフ
Camelot Software, Ltd. | |(株)キャメロット
"Contrary to popular belief, penguins are not the salvation of modern
technology. Neither do they throw parties for the urban proletariat."