diff options
| author | Eli Zaretskii | 2014-05-20 19:28:39 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-05-20 19:28:39 +0300 |
| commit | ebdc80316a464f7e6f827f8b79570e47a8ef4812 (patch) | |
| tree | b72c368d5b615454ebf2ac062c2876de61e985bf /src | |
| parent | 293fbc914a32c67f01008c8e5c4e966c4f0e8093 (diff) | |
| download | emacs-ebdc80316a464f7e6f827f8b79570e47a8ef4812.tar.gz emacs-ebdc80316a464f7e6f827f8b79570e47a8ef4812.zip | |
Fix bug #17524 with crashes in creating a new frame with invalid font.
src/w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are
unwinding when frame's faces were not initialized yet, increment
the frame's image-cache reference count before calling
x_free_frame_resources. Don't dereference
dpyinfo->terminal->image_cache if it is NULL.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/w32fns.c | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2283677a448..cb54bbd0e70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-05-20 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are | ||
| 4 | unwinding when frame's faces were not initialized yet, increment | ||
| 5 | the frame's image-cache reference count before calling | ||
| 6 | x_free_frame_resources. Don't dereference | ||
| 7 | dpyinfo->terminal->image_cache if it is NULL. (Bug#17524) | ||
| 8 | |||
| 1 | 2014-05-11 Glenn Morris <rgm@gnu.org> | 9 | 2014-05-11 Glenn Morris <rgm@gnu.org> |
| 2 | 10 | ||
| 3 | * fileio.c (Ffile_executable_p): Doc tweak. | 11 | * fileio.c (Ffile_executable_p): Doc tweak. |
diff --git a/src/w32fns.c b/src/w32fns.c index 630059c38f1..638c617df99 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -4245,6 +4245,17 @@ unwind_create_frame (Lisp_Object frame) | |||
| 4245 | { | 4245 | { |
| 4246 | #ifdef GLYPH_DEBUG | 4246 | #ifdef GLYPH_DEBUG |
| 4247 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 4247 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 4248 | |||
| 4249 | /* If the frame's image cache refcount is still the same as our | ||
| 4250 | private shadow variable, it means we are unwinding a frame | ||
| 4251 | for which we didn't yet call init_frame_faces, where the | ||
| 4252 | refcount is incremented. Therefore, we increment it here, so | ||
| 4253 | that free_frame_faces, called in x_free_frame_resources | ||
| 4254 | below, will not mistakenly decrement the counter that was not | ||
| 4255 | incremented yet to account for this new frame. */ | ||
| 4256 | if (FRAME_IMAGE_CACHE (f) != NULL | ||
| 4257 | && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount) | ||
| 4258 | FRAME_IMAGE_CACHE (f)->refcount++; | ||
| 4248 | #endif | 4259 | #endif |
| 4249 | 4260 | ||
| 4250 | x_free_frame_resources (f); | 4261 | x_free_frame_resources (f); |
| @@ -4255,7 +4266,8 @@ unwind_create_frame (Lisp_Object frame) | |||
| 4255 | eassert (dpyinfo->reference_count == dpyinfo_refcount); | 4266 | eassert (dpyinfo->reference_count == dpyinfo_refcount); |
| 4256 | eassert ((dpyinfo->terminal->image_cache == NULL | 4267 | eassert ((dpyinfo->terminal->image_cache == NULL |
| 4257 | && image_cache_refcount == 0) | 4268 | && image_cache_refcount == 0) |
| 4258 | || dpyinfo->terminal->image_cache->refcount == image_cache_refcount); | 4269 | || (dpyinfo->terminal->image_cache != NULL |
| 4270 | && dpyinfo->terminal->image_cache->refcount == image_cache_refcount)); | ||
| 4259 | #endif | 4271 | #endif |
| 4260 | return Qt; | 4272 | return Qt; |
| 4261 | } | 4273 | } |