emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src nsfns.m image.c nsfont.m nsimage.m ns...


From: Adrian Robert
Subject: [Emacs-diffs] emacs/src nsfns.m image.c nsfont.m nsimage.m ns...
Date: Tue, 25 Nov 2008 02:45:41 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Adrian Robert <arobert> 08/11/25 02:45:41

Modified files:
        src            : nsfns.m image.c nsfont.m nsimage.m nsmenu.m 
                         nsselect.m nsterm.m 

Log message:
        Fix bug #1362. * image.c (x_clear_image_1): Do not free background 
under HAVE_NS, it is not an indexed color.  * nsterm.m (free_indexed_color): 
Add argument checking.  * nsfns.m: Move config.h to before system includes 
(advised by Dan N.).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsfns.m?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/src/image.c?cvsroot=emacs&r1=1.114&r2=1.115
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsfont.m?cvsroot=emacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsimage.m?cvsroot=emacs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsmenu.m?cvsroot=emacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsselect.m?cvsroot=emacs&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsterm.m?cvsroot=emacs&r1=1.35&r2=1.36

Patches:
Index: nsfns.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfns.m,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- nsfns.m     22 Oct 2008 12:51:30 -0000      1.26
+++ nsfns.m     25 Nov 2008 02:45:39 -0000      1.27
@@ -25,9 +25,13 @@
 GNUstep port and post-20 update by Adrian Robert (address@hidden)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
+#include "config.h"
+
 #include <signal.h>
 #include <math.h>
-#include "config.h"
+
 #include "lisp.h"
 #include "blockinput.h"
 #include "nsterm.h"
@@ -36,7 +40,6 @@
 #include "keyboard.h"
 #include "termhooks.h"
 #include "fontset.h"
-
 #include "character.h"
 #include "font.h"
 

Index: image.c
===================================================================
RCS file: /sources/emacs/emacs/src/image.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- image.c     3 Oct 2008 18:23:43 -0000       1.114
+++ image.c     25 Nov 2008 02:45:39 -0000      1.115
@@ -1622,10 +1622,7 @@
     {
       Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap);
       img->pixmap = NO_PIXMAP;
-#ifdef HAVE_NS
-      if (img->background_valid)
-        ns_free_indexed_color(img->background, f);
-#endif
+      /* NOTE (HAVE_NS): background color is NOT an indexed color! */
       img->background_valid = 0;
     }
 

Index: nsfont.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfont.m,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- nsfont.m    1 Oct 2008 17:12:51 -0000       1.15
+++ nsfont.m    25 Nov 2008 02:45:40 -0000      1.16
@@ -20,6 +20,8 @@
 Author: Adrian Robert (address@hidden)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
 
 #include "lisp.h"

Index: nsimage.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsimage.m,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- nsimage.m   16 Jul 2008 02:22:04 -0000      1.4
+++ nsimage.m   25 Nov 2008 02:45:40 -0000      1.5
@@ -25,7 +25,10 @@
 GNUstep port and post-20 update by Adrian Robert (address@hidden)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
+
 #include "lisp.h"
 #include "dispextern.h"
 #include "nsterm.h"

Index: nsmenu.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- nsmenu.m    5 Aug 2008 03:05:14 -0000       1.10
+++ nsmenu.m    25 Nov 2008 02:45:40 -0000      1.11
@@ -21,7 +21,10 @@
 Christian Limpach, Scott Bender, Christophe de Dinechin) and code in the
 Carbon version by Yamamoto Mitsuharu. */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
+
 #include "lisp.h"
 #include "window.h"
 #include "buffer.h"

Index: nsselect.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsselect.m,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- nsselect.m  28 Jul 2008 01:41:57 -0000      1.8
+++ nsselect.m  25 Nov 2008 02:45:40 -0000      1.9
@@ -25,7 +25,10 @@
 GNUstep port and post-20 update by Adrian Robert (address@hidden)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
+
 #include "lisp.h"
 #include "nsterm.h"
 #include "termhooks.h"

Index: nsterm.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsterm.m,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- nsterm.m    15 Nov 2008 05:20:49 -0000      1.35
+++ nsterm.m    25 Nov 2008 02:45:40 -0000      1.36
@@ -25,12 +25,15 @@
 GNUstep port and post-20 update by Adrian Robert (address@hidden)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
+#include "config.h"
+
 #include <math.h>
 #include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
 
-#include "config.h"
 #include "lisp.h"
 #include "blockinput.h"
 #include "sysselect.h"
@@ -1280,7 +1283,6 @@
                                    color_table->size * sizeof (NSColor *));
         }
       idx = color_table->avail++;
-      index = [NSNumber numberWithUnsignedInt: idx];
     }
 
   color_table->colors[idx] = color;
@@ -1293,10 +1295,26 @@
 void
 ns_free_indexed_color (unsigned long idx, struct frame *f)
 {
-  struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table;
+  struct ns_color_table *color_table;
   NSColor *color;
-  if (!idx)
+  NSNumber *index;
+
+  if (!f)
+    return;
+
+  color_table = FRAME_NS_DISPLAY_INFO (f)->color_table;
+
+  if (idx <= 0 || idx >= color_table->size) {
+    message1("ns_free_indexed_color: Color index out of range.\n");
+    return;
+  }
+
+  index = [NSNumber numberWithUnsignedInt: idx];
+  if ([color_table->empty_indices containsObject: index]) {
+    message1("ns_free_indexed_color: attempt to free already freed color.\n");
     return;
+  }
+
   color = color_table->colors[idx];
   [color release];
   color_table->colors[idx] = nil;




reply via email to

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