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));
SelectObject (context, old_font);
release_frame_dc (f, context);
+ Vinhibit_quit = prev_quit;
return capability;
}
face-override for drawing S. */
#ifdef HAVE_NTGUI
-#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))
-#endif
-
-#ifndef OPTIONAL_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
+#else
+# define ALLOCATE_HDC(hdc, f)
+# define RELEASE_HDC(hdc, f)
#endif
static void
init_glyph_string (struct glyph_string *s,
- OPTIONAL_HDC (hdc)
+#ifdef HAVE_NTGUI
+ HDC hdc,
+#endif
XChar2b *char2b, struct window *w, struct glyph_row *row,
enum glyph_row_area area, int start, enum draw_glyphs_face hl)
{
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));
- DECLARE_HDC (hdc);
ALLOCATE_HDC (hdc, f);