Commit 00ba2267 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent b26d6373
Pipeline #524 passed with stage
in 25 minutes and 34 seconds
......@@ -176,6 +176,11 @@ uniscribe_otf_capability (struct font *font)
Lisp_Object features;
f = XFRAME (selected_frame);
/* Prevent quitting while we cons the lists in otf_features.
That's because get_frame_dc acquires the critical section, so we
cannot quit before we release it in release_frame_dc. */
Lisp_Object prev_quit = Vinhibit_quit;
Vinhibit_quit = Qt;
context = get_frame_dc (f);
old_font = SelectObject (context, FONT_HANDLE (font));
......@@ -186,6 +191,7 @@ uniscribe_otf_capability (struct font *font)
SelectObject (context, old_font);
release_frame_dc (f, context);
Vinhibit_quit = prev_quit;
return capability;
......@@ -25619,22 +25619,28 @@ dump_glyph_string (struct glyph_string *s)
face-override for drawing S. */
#define OPTIONAL_HDC(hdc) HDC hdc,
#define DECLARE_HDC(hdc) HDC hdc;
#define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f))
#define RELEASE_HDC(hdc, f) release_frame_dc ((f), (hdc))
#define OPTIONAL_HDC(hdc)
#define DECLARE_HDC(hdc)
#define ALLOCATE_HDC(hdc, f)
#define RELEASE_HDC(hdc, f)
/* We set inhibit-quit here due to paranoia: get_frame_dc acquires the
critical section, and we cannot QUIT while we hold the critical
section. If any of the code run by callers of ALLOCATE_HDC happens
to call Lisp (might be possible due to all the hooks lying around),
we must prevent it from quitting. */
# define ALLOCATE_HDC(hdc, f) \
Lisp_Object prev_quit = Vinhibit_quit; \
Vinhibit_quit = Qt; \
HDC hdc = get_frame_dc ((f))
# define RELEASE_HDC(hdc, f) \
release_frame_dc ((f), (hdc)); \
Vinhibit_quit = prev_quit
# define ALLOCATE_HDC(hdc, f)
# define RELEASE_HDC(hdc, f)
static void
init_glyph_string (struct glyph_string *s,
HDC hdc,
XChar2b *char2b, struct window *w, struct glyph_row *row,
enum glyph_row_area area, int start, enum draw_glyphs_face hl)
......@@ -26674,7 +26680,6 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
struct glyph_string *clip_head = NULL, *clip_tail = NULL;
int i, j, x_reached, last_x, area_left = 0;
struct frame *f = XFRAME (WINDOW_FRAME (w));
ALLOCATE_HDC (hdc, f);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment