diff options
| author | Adrian Robert | 2008-11-25 02:45:39 +0000 |
|---|---|---|
| committer | Adrian Robert | 2008-11-25 02:45:39 +0000 |
| commit | 5a06864fb69973eb2be01e230a98d6c24ff2138c (patch) | |
| tree | 4a9039884d5f65352c64a72970a8fdd198e3476f /src | |
| parent | 3a37fceafaf3bf2697849012e20d265a228d431b (diff) | |
| download | emacs-5a06864fb69973eb2be01e230a98d6c24ff2138c.tar.gz emacs-5a06864fb69973eb2be01e230a98d6c24ff2138c.zip | |
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.).
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 5 | ||||
| -rw-r--r-- | src/nsfns.m | 7 | ||||
| -rw-r--r-- | src/nsfont.m | 2 | ||||
| -rw-r--r-- | src/nsimage.m | 3 | ||||
| -rw-r--r-- | src/nsmenu.m | 3 | ||||
| -rw-r--r-- | src/nsselect.m | 3 | ||||
| -rw-r--r-- | src/nsterm.m | 26 |
7 files changed, 39 insertions, 10 deletions
diff --git a/src/image.c b/src/image.c index b24feca3779..6701637f951 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1622,10 +1622,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) | |||
| 1622 | { | 1622 | { |
| 1623 | Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap); | 1623 | Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap); |
| 1624 | img->pixmap = NO_PIXMAP; | 1624 | img->pixmap = NO_PIXMAP; |
| 1625 | #ifdef HAVE_NS | 1625 | /* NOTE (HAVE_NS): background color is NOT an indexed color! */ |
| 1626 | if (img->background_valid) | ||
| 1627 | ns_free_indexed_color(img->background, f); | ||
| 1628 | #endif | ||
| 1629 | img->background_valid = 0; | 1626 | img->background_valid = 0; |
| 1630 | } | 1627 | } |
| 1631 | 1628 | ||
diff --git a/src/nsfns.m b/src/nsfns.m index 459c058f7ca..2e2d6a77b75 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -25,9 +25,13 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net) | |||
| 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | ||
| 29 | interpretation of even the system includes. */ | ||
| 30 | #include "config.h" | ||
| 31 | |||
| 28 | #include <signal.h> | 32 | #include <signal.h> |
| 29 | #include <math.h> | 33 | #include <math.h> |
| 30 | #include "config.h" | 34 | |
| 31 | #include "lisp.h" | 35 | #include "lisp.h" |
| 32 | #include "blockinput.h" | 36 | #include "blockinput.h" |
| 33 | #include "nsterm.h" | 37 | #include "nsterm.h" |
| @@ -36,7 +40,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 36 | #include "keyboard.h" | 40 | #include "keyboard.h" |
| 37 | #include "termhooks.h" | 41 | #include "termhooks.h" |
| 38 | #include "fontset.h" | 42 | #include "fontset.h" |
| 39 | |||
| 40 | #include "character.h" | 43 | #include "character.h" |
| 41 | #include "font.h" | 44 | #include "font.h" |
| 42 | 45 | ||
diff --git a/src/nsfont.m b/src/nsfont.m index 7adced73c12..fa5387aa0f0 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | Author: Adrian Robert (arobert@cogsci.ucsd.edu) | 20 | Author: Adrian Robert (arobert@cogsci.ucsd.edu) |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | /* This should be the first include, as it may set up #defines affecting | ||
| 24 | interpretation of even the system includes. */ | ||
| 23 | #include "config.h" | 25 | #include "config.h" |
| 24 | 26 | ||
| 25 | #include "lisp.h" | 27 | #include "lisp.h" |
diff --git a/src/nsimage.m b/src/nsimage.m index cf974be6c43..0cbb4d0d116 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -25,7 +25,10 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net) | |||
| 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | ||
| 29 | interpretation of even the system includes. */ | ||
| 28 | #include "config.h" | 30 | #include "config.h" |
| 31 | |||
| 29 | #include "lisp.h" | 32 | #include "lisp.h" |
| 30 | #include "dispextern.h" | 33 | #include "dispextern.h" |
| 31 | #include "nsterm.h" | 34 | #include "nsterm.h" |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 825568f6557..8b06bdaddf8 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -21,7 +21,10 @@ By Adrian Robert, based on code from original nsmenu.m (Carl Edman, | |||
| 21 | Christian Limpach, Scott Bender, Christophe de Dinechin) and code in the | 21 | Christian Limpach, Scott Bender, Christophe de Dinechin) and code in the |
| 22 | Carbon version by Yamamoto Mitsuharu. */ | 22 | Carbon version by Yamamoto Mitsuharu. */ |
| 23 | 23 | ||
| 24 | /* This should be the first include, as it may set up #defines affecting | ||
| 25 | interpretation of even the system includes. */ | ||
| 24 | #include "config.h" | 26 | #include "config.h" |
| 27 | |||
| 25 | #include "lisp.h" | 28 | #include "lisp.h" |
| 26 | #include "window.h" | 29 | #include "window.h" |
| 27 | #include "buffer.h" | 30 | #include "buffer.h" |
diff --git a/src/nsselect.m b/src/nsselect.m index 88f8b262507..fbbe86ecf51 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -25,7 +25,10 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net) | |||
| 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | ||
| 29 | interpretation of even the system includes. */ | ||
| 28 | #include "config.h" | 30 | #include "config.h" |
| 31 | |||
| 29 | #include "lisp.h" | 32 | #include "lisp.h" |
| 30 | #include "nsterm.h" | 33 | #include "nsterm.h" |
| 31 | #include "termhooks.h" | 34 | #include "termhooks.h" |
diff --git a/src/nsterm.m b/src/nsterm.m index ccfee9b57b0..d8b4f60aba7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -25,12 +25,15 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net) | |||
| 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | ||
| 29 | interpretation of even the system includes. */ | ||
| 30 | #include "config.h" | ||
| 31 | |||
| 28 | #include <math.h> | 32 | #include <math.h> |
| 29 | #include <sys/types.h> | 33 | #include <sys/types.h> |
| 30 | #include <time.h> | 34 | #include <time.h> |
| 31 | #include <unistd.h> | 35 | #include <unistd.h> |
| 32 | 36 | ||
| 33 | #include "config.h" | ||
| 34 | #include "lisp.h" | 37 | #include "lisp.h" |
| 35 | #include "blockinput.h" | 38 | #include "blockinput.h" |
| 36 | #include "sysselect.h" | 39 | #include "sysselect.h" |
| @@ -1280,7 +1283,6 @@ ns_index_color (NSColor *color, struct frame *f) | |||
| 1280 | color_table->size * sizeof (NSColor *)); | 1283 | color_table->size * sizeof (NSColor *)); |
| 1281 | } | 1284 | } |
| 1282 | idx = color_table->avail++; | 1285 | idx = color_table->avail++; |
| 1283 | index = [NSNumber numberWithUnsignedInt: idx]; | ||
| 1284 | } | 1286 | } |
| 1285 | 1287 | ||
| 1286 | color_table->colors[idx] = color; | 1288 | color_table->colors[idx] = color; |
| @@ -1293,10 +1295,26 @@ ns_index_color (NSColor *color, struct frame *f) | |||
| 1293 | void | 1295 | void |
| 1294 | ns_free_indexed_color (unsigned long idx, struct frame *f) | 1296 | ns_free_indexed_color (unsigned long idx, struct frame *f) |
| 1295 | { | 1297 | { |
| 1296 | struct ns_color_table *color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; | 1298 | struct ns_color_table *color_table; |
| 1297 | NSColor *color; | 1299 | NSColor *color; |
| 1298 | if (!idx) | 1300 | NSNumber *index; |
| 1301 | |||
| 1302 | if (!f) | ||
| 1303 | return; | ||
| 1304 | |||
| 1305 | color_table = FRAME_NS_DISPLAY_INFO (f)->color_table; | ||
| 1306 | |||
| 1307 | if (idx <= 0 || idx >= color_table->size) { | ||
| 1308 | message1("ns_free_indexed_color: Color index out of range.\n"); | ||
| 1299 | return; | 1309 | return; |
| 1310 | } | ||
| 1311 | |||
| 1312 | index = [NSNumber numberWithUnsignedInt: idx]; | ||
| 1313 | if ([color_table->empty_indices containsObject: index]) { | ||
| 1314 | message1("ns_free_indexed_color: attempt to free already freed color.\n"); | ||
| 1315 | return; | ||
| 1316 | } | ||
| 1317 | |||
| 1300 | color = color_table->colors[idx]; | 1318 | color = color_table->colors[idx]; |
| 1301 | [color release]; | 1319 | [color release]; |
| 1302 | color_table->colors[idx] = nil; | 1320 | color_table->colors[idx] = nil; |