diff options
| author | Po Lu | 2024-04-13 19:43:40 +0800 |
|---|---|---|
| committer | Po Lu | 2024-04-13 19:44:34 +0800 |
| commit | 9fc698479feef6fa660ff13e21619ea50bd404df (patch) | |
| tree | 89af5b1e136fd6273db592a61e2255bb3a4ea717 /src/image.c | |
| parent | adbcf268bc81c439f90b1016700d8a0a234e12b7 (diff) | |
| download | emacs-9fc698479feef6fa660ff13e21619ea50bd404df.tar.gz emacs-9fc698479feef6fa660ff13e21619ea50bd404df.zip | |
Fix crash upon call to Fset_fontset_font after X server disconnect
* src/image.c (free_image):
* src/xfaces.c (free_realized_face): Handle scenarios where
free_frame_faces is called with the display connection cut.
* src/xterm.c (x_free_frame_resources): Call free_frame_faces
unconditionally, lest fontsets for this dead frame contaminate
Vfontset_list and produce crashes afterwards. (bug#66151)
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c index 216bdc1ee66..3968145728f 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1699,14 +1699,26 @@ free_image (struct frame *f, struct image *img) | |||
| 1699 | c->images[img->id] = NULL; | 1699 | c->images[img->id] = NULL; |
| 1700 | 1700 | ||
| 1701 | #if !defined USE_CAIRO && defined HAVE_XRENDER | 1701 | #if !defined USE_CAIRO && defined HAVE_XRENDER |
| 1702 | if (img->picture) | 1702 | /* FRAME_X_DISPLAY (f) could be NULL if this is being called from |
| 1703 | XRenderFreePicture (FRAME_X_DISPLAY (f), img->picture); | 1703 | the display IO error handler.*/ |
| 1704 | if (img->mask_picture) | 1704 | |
| 1705 | XRenderFreePicture (FRAME_X_DISPLAY (f), img->mask_picture); | 1705 | if (FRAME_X_DISPLAY (f)) |
| 1706 | #endif | 1706 | { |
| 1707 | if (img->picture) | ||
| 1708 | XRenderFreePicture (FRAME_X_DISPLAY (f), | ||
| 1709 | img->picture); | ||
| 1710 | if (img->mask_picture) | ||
| 1711 | XRenderFreePicture (FRAME_X_DISPLAY (f), | ||
| 1712 | img->mask_picture); | ||
| 1713 | } | ||
| 1714 | #endif /* !USE_CAIRO && HAVE_XRENDER */ | ||
| 1715 | |||
| 1716 | #ifdef HAVE_X_WINDOWS | ||
| 1717 | if (FRAME_X_DISPLAY (f)) | ||
| 1718 | #endif /* HAVE_X_WINDOWS */ | ||
| 1719 | /* Free resources, then free IMG. */ | ||
| 1720 | img->type->free_img (f, img); | ||
| 1707 | 1721 | ||
| 1708 | /* Free resources, then free IMG. */ | ||
| 1709 | img->type->free_img (f, img); | ||
| 1710 | xfree (img->face_font_family); | 1722 | xfree (img->face_font_family); |
| 1711 | xfree (img); | 1723 | xfree (img); |
| 1712 | } | 1724 | } |