aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2019-01-14 17:36:04 +0200
committerEli Zaretskii2019-01-14 17:36:04 +0200
commit00ba2267ede311da0cd53261780fb0b781ca42dd (patch)
tree382b50db5ac01ecd7d3542b0e3e952c4b25f122b /src
parentb26d6373c48ca26a7cfc81fd03ec8d7f50c13962 (diff)
downloademacs-00ba2267ede311da0cd53261780fb0b781ca42dd.tar.gz
emacs-00ba2267ede311da0cd53261780fb0b781ca42dd.zip
Attempt to fix hangs on MS-Windows due to C-g
* src/w32uniscribe.c (uniscribe_otf_capability): Set inhibit-quit around calls to otf_features, because the latter cons Lisp data structures while we are in a critical section. * src/xdisp.c (ALLOCATE_HDC) [HAVE_NTGUI]: Set inhibit-quit. (RELEASE_HDC) [HAVE_NTGUI]: Restore inhibit-quit. (OPTIONAL_HDC, DECLARE_HDC): Remove macros, their job is now done by ALLOCATE_HDC and by a single #ifdef. (draw_glyphs): Adapt to the above changes in macros. (Bug#34059)
Diffstat (limited to 'src')
-rw-r--r--src/w32uniscribe.c6
-rw-r--r--src/xdisp.c31
2 files changed, 24 insertions, 13 deletions
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 33959cd05c8..28050d6ac76 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -176,6 +176,11 @@ uniscribe_otf_capability (struct font *font)
176 Lisp_Object features; 176 Lisp_Object features;
177 177
178 f = XFRAME (selected_frame); 178 f = XFRAME (selected_frame);
179 /* Prevent quitting while we cons the lists in otf_features.
180 That's because get_frame_dc acquires the critical section, so we
181 cannot quit before we release it in release_frame_dc. */
182 Lisp_Object prev_quit = Vinhibit_quit;
183 Vinhibit_quit = Qt;
179 context = get_frame_dc (f); 184 context = get_frame_dc (f);
180 old_font = SelectObject (context, FONT_HANDLE (font)); 185 old_font = SelectObject (context, FONT_HANDLE (font));
181 186
@@ -186,6 +191,7 @@ uniscribe_otf_capability (struct font *font)
186 191
187 SelectObject (context, old_font); 192 SelectObject (context, old_font);
188 release_frame_dc (f, context); 193 release_frame_dc (f, context);
194 Vinhibit_quit = prev_quit;
189 195
190 return capability; 196 return capability;
191} 197}
diff --git a/src/xdisp.c b/src/xdisp.c
index 274ab8ddf51..94ce1c29a0c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25619,22 +25619,28 @@ dump_glyph_string (struct glyph_string *s)
25619 face-override for drawing S. */ 25619 face-override for drawing S. */
25620 25620
25621#ifdef HAVE_NTGUI 25621#ifdef HAVE_NTGUI
25622#define OPTIONAL_HDC(hdc) HDC hdc, 25622/* We set inhibit-quit here due to paranoia: get_frame_dc acquires the
25623#define DECLARE_HDC(hdc) HDC hdc; 25623 critical section, and we cannot QUIT while we hold the critical
25624#define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f)) 25624 section. If any of the code run by callers of ALLOCATE_HDC happens
25625#define RELEASE_HDC(hdc, f) release_frame_dc ((f), (hdc)) 25625 to call Lisp (might be possible due to all the hooks lying around),
25626#endif 25626 we must prevent it from quitting. */
25627 25627# define ALLOCATE_HDC(hdc, f) \
25628#ifndef OPTIONAL_HDC 25628 Lisp_Object prev_quit = Vinhibit_quit; \
25629#define OPTIONAL_HDC(hdc) 25629 Vinhibit_quit = Qt; \
25630#define DECLARE_HDC(hdc) 25630 HDC hdc = get_frame_dc ((f))
25631#define ALLOCATE_HDC(hdc, f) 25631# define RELEASE_HDC(hdc, f) \
25632#define RELEASE_HDC(hdc, f) 25632 release_frame_dc ((f), (hdc)); \
25633 Vinhibit_quit = prev_quit
25634#else
25635# define ALLOCATE_HDC(hdc, f)
25636# define RELEASE_HDC(hdc, f)
25633#endif 25637#endif
25634 25638
25635static void 25639static void
25636init_glyph_string (struct glyph_string *s, 25640init_glyph_string (struct glyph_string *s,
25637 OPTIONAL_HDC (hdc) 25641#ifdef HAVE_NTGUI
25642 HDC hdc,
25643#endif
25638 XChar2b *char2b, struct window *w, struct glyph_row *row, 25644 XChar2b *char2b, struct window *w, struct glyph_row *row,
25639 enum glyph_row_area area, int start, enum draw_glyphs_face hl) 25645 enum glyph_row_area area, int start, enum draw_glyphs_face hl)
25640{ 25646{
@@ -26674,7 +26680,6 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
26674 struct glyph_string *clip_head = NULL, *clip_tail = NULL; 26680 struct glyph_string *clip_head = NULL, *clip_tail = NULL;
26675 int i, j, x_reached, last_x, area_left = 0; 26681 int i, j, x_reached, last_x, area_left = 0;
26676 struct frame *f = XFRAME (WINDOW_FRAME (w)); 26682 struct frame *f = XFRAME (WINDOW_FRAME (w));
26677 DECLARE_HDC (hdc);
26678 26683
26679 ALLOCATE_HDC (hdc, f); 26684 ALLOCATE_HDC (hdc, f);
26680 26685