emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Two problems in Emacs-21.2.91 on Windows]


From: Juanma Barranquero
Subject: Re: address@hidden: Two problems in Emacs-21.2.91 on Windows]
Date: Wed, 23 Oct 2002 14:06:10 +0200

On Wed, 23 Oct 2002 03:10:35 -0400, Richard Stallman <address@hidden> wrote:

> Any ideas for what to do here?

With respect to:

> 2) Bug in w32_term_init in w32term.c.
> 
> This function calls w32_defined_color to do lookups of colors "white" and 
> "black".  It passes a pointer to a COLORDEF, but w32_term_init expects a 
> pointer to an XColor.  Debug builds run fine, but on optimized builds you 
> get a stack corruption and Emacs fails before painting the first window.  I 
> hacked this by pasting in the definition for XColor into w32term.c and 
> passing in one of those, but I figure somebody would want to actually move 
> that structure to a header.  A function prototype wouldn't hurt either :-)

the following patch would do, I think.

Basically it makes sense to extract the definition of XColor from the
three or four places it happens now and define it specifically in the
*gui.h files of the platforms that need it (w32gui.h and macgui.h at
this moment). The same bug is also present in EMACS_21_1_RC, BTW. If the
patch is approved it should be applied to the pretest too.

It works on my system. I've not commited the patch because I don't want
to change Mac files without Andrew Choi's approval, specially as I
can not test the changes on that platform. 

I've maintained the #ifndef HAVE_X_WINDOWS guards. On Window systems
probably that's unnecesary, but on Macs I bet they're needed if you
happen to build on Mac OS X.

Comments?

                                                           /L/e/k/t/u



Index: macfns.c
===================================================================
RCS file: /cvs/emacs/src/macfns.c,v
retrieving revision 1.16
diff -u -2 -r1.16 macfns.c
--- macfns.c    18 Oct 2002 09:57:48 -0000      1.16
+++ macfns.c    23 Oct 2002 11:48:30 -0000
@@ -100,14 +100,4 @@
 extern int quit_char;*/
 
-/* A definition of XColor for non-X frames.  */
-#ifndef HAVE_X_WINDOWS
-typedef struct {
-  unsigned long pixel;
-  unsigned short red, green, blue;
-  char flags;
-  char pad;
-} XColor;
-#endif
-
 extern char *lispy_function_keys[];
 
Index: macgui.h
===================================================================
RCS file: /cvs/emacs/src/macgui.h,v
retrieving revision 1.1
diff -u -2 -r1.1 macgui.h
--- macgui.h    26 Apr 2002 23:39:05 -0000      1.1
+++ macgui.h    23 Oct 2002 11:48:30 -0000
@@ -38,4 +38,14 @@
 #endif
 
+/* A definition of XColor for non-X frames.  */
+#ifndef HAVE_X_WINDOWS
+typedef struct {
+  unsigned long pixel;
+  unsigned short red, green, blue;
+  char flags;
+  char pad;
+} XColor;
+#endif
+
 #define FACE_DEFAULT (~0)
 
Index: w32fns.c
===================================================================
RCS file: /cvs/emacs/src/w32fns.c,v
retrieving revision 1.185
diff -u -2 -r1.185 w32fns.c
--- w32fns.c    18 Oct 2002 09:54:27 -0000      1.185
+++ w32fns.c    23 Oct 2002 11:48:31 -0000
@@ -65,14 +65,4 @@
 extern int quit_char;
 
-/* A definition of XColor for non-X frames.  */
-#ifndef HAVE_X_WINDOWS
-typedef struct {
-  unsigned long pixel;
-  unsigned short red, green, blue;
-  char flags;
-  char pad;
-} XColor;
-#endif
-
 extern char *lispy_function_keys[];
 
Index: w32gui.h
===================================================================
RCS file: /cvs/emacs/src/w32gui.h,v
retrieving revision 1.15
diff -u -2 -r1.15 w32gui.h
--- w32gui.h    20 Mar 2002 21:00:50 -0000      1.15
+++ w32gui.h    23 Oct 2002 11:48:31 -0000
@@ -87,4 +87,14 @@
 } XImage;
 
+/* A definition of XColor for non-X frames.  */
+#ifndef HAVE_X_WINDOWS
+typedef struct {
+  unsigned long pixel;
+  unsigned short red, green, blue;
+  char flags;
+  char pad;
+} XColor;
+#endif
+
 #define FACE_DEFAULT (~0)
 
Index: w32term.c
===================================================================
RCS file: /cvs/emacs/src/w32term.c,v
retrieving revision 1.166
diff -u -2 -r1.166 w32term.c
--- w32term.c   30 Aug 2002 13:19:45 -0000      1.166
+++ w32term.c   23 Oct 2002 11:48:32 -0000
@@ -11125,5 +11125,5 @@
   /* initialise palette with white and black */
   {
-    COLORREF color;
+    XColor color;
     w32_defined_color (0, "white", &color, 1);
     w32_defined_color (0, "black", &color, 1);
Index: xfaces.c
===================================================================
RCS file: /cvs/emacs/src/xfaces.c,v
retrieving revision 1.264
diff -u -2 -r1.264 xfaces.c
--- xfaces.c    27 Sep 2002 00:43:40 -0000      1.264
+++ xfaces.c    23 Oct 2002 11:48:33 -0000
@@ -298,19 +298,4 @@
 #define FACE_CACHE_BUCKETS_SIZE 1001
 
-/* A definition of XColor for non-X frames.  */
-
-#ifndef HAVE_X_WINDOWS
-
-typedef struct
-{
-  unsigned long pixel;
-  unsigned short red, green, blue;
-  char flags;
-  char pad;
-}
-XColor;
-
-#endif /* not HAVE_X_WINDOWS */
-
 /* Keyword symbols used for face attribute names.  */
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]