diff options
| author | Eli Zaretskii | 2015-11-24 18:08:39 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-11-24 18:08:39 +0200 |
| commit | d5fdffecdfad305d9c933ae3cad75a5e4e73878c (patch) | |
| tree | 91c34e1102fdd828c530dabb342eae7c796bd748 /src/font.h | |
| parent | a67cc630db28cf734d0e47f231add30c782bd8cf (diff) | |
| download | emacs-d5fdffecdfad305d9c933ae3cad75a5e4e73878c.tar.gz emacs-d5fdffecdfad305d9c933ae3cad75a5e4e73878c.zip | |
Fix crash at startup related to GC of font entities
* src/font.h (GC_FONT_SPEC_P, GC_FONT_ENTITY_P)
(GC_FONT_OBJECT_P, GC_XFONT_SPEC, GC_XFONT_ENTITY)
(GC_XFONT_OBJECT): New macros, for use in garbage collector.
* src/alloc.c (compact_font_cache_entry, compact_font_caches):
Don't ifdef away font cache compaction on NT_GUI, as the problems
which led to that seem to have been solved.
(compact_font_cache_entry): Use GC_FONT_SPEC_P, GC_XFONT_SPEC,
GC_XFONT_ENTITY, and GC_XFONT_OBJECT, instead of their non-GC_
cousins. (Bug#21999)
Diffstat (limited to 'src/font.h')
| -rw-r--r-- | src/font.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/font.h b/src/font.h index 1d13e1cb6b0..24c058dd88b 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -427,6 +427,13 @@ FONT_SPEC_P (Lisp_Object x) | |||
| 427 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; | 427 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | /* Like FONT_SPEC_P, but can be used in the garbage collector. */ | ||
| 431 | INLINE bool | ||
| 432 | GC_FONT_SPEC_P (Lisp_Object x) | ||
| 433 | { | ||
| 434 | return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; | ||
| 435 | } | ||
| 436 | |||
| 430 | /* True iff X is font-entity. */ | 437 | /* True iff X is font-entity. */ |
| 431 | INLINE bool | 438 | INLINE bool |
| 432 | FONT_ENTITY_P (Lisp_Object x) | 439 | FONT_ENTITY_P (Lisp_Object x) |
| @@ -434,6 +441,13 @@ FONT_ENTITY_P (Lisp_Object x) | |||
| 434 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; | 441 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; |
| 435 | } | 442 | } |
| 436 | 443 | ||
| 444 | /* Like FONT_ENTITY_P, but can be used in the garbage collector. */ | ||
| 445 | INLINE bool | ||
| 446 | GC_FONT_ENTITY_P (Lisp_Object x) | ||
| 447 | { | ||
| 448 | return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; | ||
| 449 | } | ||
| 450 | |||
| 437 | /* True iff X is font-object. */ | 451 | /* True iff X is font-object. */ |
| 438 | INLINE bool | 452 | INLINE bool |
| 439 | FONT_OBJECT_P (Lisp_Object x) | 453 | FONT_OBJECT_P (Lisp_Object x) |
| @@ -441,6 +455,13 @@ FONT_OBJECT_P (Lisp_Object x) | |||
| 441 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; | 455 | return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; |
| 442 | } | 456 | } |
| 443 | 457 | ||
| 458 | /* Like FONT_OBJECT_P, but can be used in the garbage collector. */ | ||
| 459 | INLINE bool | ||
| 460 | GC_FONT_OBJECT_P (Lisp_Object x) | ||
| 461 | { | ||
| 462 | return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; | ||
| 463 | } | ||
| 464 | |||
| 444 | /* Type checking functions for various font-related objects. */ | 465 | /* Type checking functions for various font-related objects. */ |
| 445 | 466 | ||
| 446 | INLINE void | 467 | INLINE void |
| @@ -476,6 +497,13 @@ XFONT_SPEC (Lisp_Object p) | |||
| 476 | return XUNTAG (p, Lisp_Vectorlike); | 497 | return XUNTAG (p, Lisp_Vectorlike); |
| 477 | } | 498 | } |
| 478 | 499 | ||
| 500 | INLINE struct font_spec * | ||
| 501 | GC_XFONT_SPEC (Lisp_Object p) | ||
| 502 | { | ||
| 503 | eassert (GC_FONT_SPEC_P (p)); | ||
| 504 | return XUNTAG (p, Lisp_Vectorlike); | ||
| 505 | } | ||
| 506 | |||
| 479 | INLINE struct font_entity * | 507 | INLINE struct font_entity * |
| 480 | XFONT_ENTITY (Lisp_Object p) | 508 | XFONT_ENTITY (Lisp_Object p) |
| 481 | { | 509 | { |
| @@ -483,6 +511,13 @@ XFONT_ENTITY (Lisp_Object p) | |||
| 483 | return XUNTAG (p, Lisp_Vectorlike); | 511 | return XUNTAG (p, Lisp_Vectorlike); |
| 484 | } | 512 | } |
| 485 | 513 | ||
| 514 | INLINE struct font_entity * | ||
| 515 | GC_XFONT_ENTITY (Lisp_Object p) | ||
| 516 | { | ||
| 517 | eassert (GC_FONT_ENTITY_P (p)); | ||
| 518 | return XUNTAG (p, Lisp_Vectorlike); | ||
| 519 | } | ||
| 520 | |||
| 486 | INLINE struct font * | 521 | INLINE struct font * |
| 487 | XFONT_OBJECT (Lisp_Object p) | 522 | XFONT_OBJECT (Lisp_Object p) |
| 488 | { | 523 | { |
| @@ -490,6 +525,13 @@ XFONT_OBJECT (Lisp_Object p) | |||
| 490 | return XUNTAG (p, Lisp_Vectorlike); | 525 | return XUNTAG (p, Lisp_Vectorlike); |
| 491 | } | 526 | } |
| 492 | 527 | ||
| 528 | INLINE struct font * | ||
| 529 | GC_XFONT_OBJECT (Lisp_Object p) | ||
| 530 | { | ||
| 531 | eassert (GC_FONT_OBJECT_P (p)); | ||
| 532 | return XUNTAG (p, Lisp_Vectorlike); | ||
| 533 | } | ||
| 534 | |||
| 493 | #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) | 535 | #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) |
| 494 | 536 | ||
| 495 | INLINE struct font * | 537 | INLINE struct font * |