From 90f4a9f8e2a4424d1ff19208aa088cfdf6fa4df9 Mon Sep 17 00:00:00 2001 From: Andrew Innes Date: Thu, 21 Dec 2000 14:58:09 +0000 Subject: [PATCH] (select_palette): Avoid calling SelectPalette if palette is NULL, since this corrupts memory! Also get display_info reference from frame. --- src/w32xfns.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/w32xfns.c b/src/w32xfns.c index 018aefdf35e..9117f7e91a9 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -84,9 +84,17 @@ signal_quit () void select_palette (FRAME_PTR f, HDC hdc) { + struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); + + if (!display_info->has_palette) + return; + + if (display_info->palette == 0) + abort (); + if (!NILP (Vw32_enable_palette)) f->output_data.w32->old_palette = - SelectPalette (hdc, one_w32_display_info.palette, FALSE); + SelectPalette (hdc, display_info->palette, FALSE); else f->output_data.w32->old_palette = NULL; -- 2.39.2