diff options
| author | Chong Yidong | 2012-09-21 11:55:23 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-09-21 11:55:23 +0800 |
| commit | cc04a16f0c94cc9b0d18d79ead290f12c3cc4f42 (patch) | |
| tree | 863a647210928c3020e0e79019253a38e25fce5f /src | |
| parent | d3fa327c47570a1767324d23d710504e90b083f9 (diff) | |
| download | emacs-cc04a16f0c94cc9b0d18d79ead290f12c3cc4f42.tar.gz emacs-cc04a16f0c94cc9b0d18d79ead290f12c3cc4f42.zip | |
Backport fix for Bug#12463 from trunk.
* image.c (define_image_type): Avoid adding duplicate types to
image_types. Suggested by Jörg Walter.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/image.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index afaa7fd776e..15b47934424 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-09-21 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * image.c (define_image_type): Avoid adding duplicate types to | ||
| 4 | image_types (Bug#12463). Suggested by Jörg Walter. | ||
| 5 | |||
| 1 | 2012-09-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 6 | 2012-09-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 7 | ||
| 3 | * unexmacosx.c: Define LC_DATA_IN_CODE if not defined. | 8 | * unexmacosx.c: Define LC_DATA_IN_CODE if not defined. |
diff --git a/src/image.c b/src/image.c index 73490fe2865..fd99bdfc950 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -597,9 +597,15 @@ define_image_type (struct image_type *type, int loaded) | |||
| 597 | success = Qnil; | 597 | success = Qnil; |
| 598 | else | 598 | else |
| 599 | { | 599 | { |
| 600 | struct image_type *p; | ||
| 601 | Lisp_Object target_type = *(type->type); | ||
| 602 | for (p = image_types; p; p = p->next) | ||
| 603 | if (EQ (*(p->type), target_type)) | ||
| 604 | return Qt; | ||
| 605 | |||
| 600 | /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. | 606 | /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. |
| 601 | The initialized data segment is read-only. */ | 607 | The initialized data segment is read-only. */ |
| 602 | struct image_type *p = (struct image_type *) xmalloc (sizeof *p); | 608 | p = (struct image_type *) xmalloc (sizeof *p); |
| 603 | memcpy (p, type, sizeof *p); | 609 | memcpy (p, type, sizeof *p); |
| 604 | p->next = image_types; | 610 | p->next = image_types; |
| 605 | image_types = p; | 611 | image_types = p; |