changeset 34783:9c0d7d896682

(select_palette): Avoid calling SelectPalette if palette is NULL, since this corrupts memory! Also get display_info reference from frame.
author Andrew Innes <andrewi@gnu.org>
date Thu, 21 Dec 2000 14:58:09 +0000
parents 92d61d3599ff
children d140f5fb3307
files src/w32xfns.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32xfns.c	Thu Dec 21 14:46:37 2000 +0000
+++ b/src/w32xfns.c	Thu Dec 21 14:58:09 2000 +0000
@@ -84,9 +84,17 @@
 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;