From 86d1db205f3e806316d87640dac728b1a683719c Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Fri, 1 Dec 2000 20:11:23 +0000 Subject: [PATCH] (get_frame_dc): Avoid changing the palette on an invalid frame. --- src/ChangeLog | 8 ++++++++ src/w32xfns.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8eec437130a..b8a419b2acb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2000-12-01 Jason Rumney + + * w32term.c (w32_clear_window): Avoid clearing an invalid frame. + + * w32xfns.c (get_frame_dc): Avoid changing the palette on an + invalid frame. + 2000-12-01 Gerd Moellmann * window.c (struct saved_window): Add members orig_top and @@ -9,6 +16,7 @@ 2000-12-01 Jason Rumney * w32term.c (x_draw_vertical_border): Fix call to w32_fill_rect. + * w32fns.c (x_set_cursor_color): Fix last change. 2000-11-30 Gerd Moellmann diff --git a/src/w32xfns.c b/src/w32xfns.c index 9624e0dd4eb..018aefdf35e 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -117,7 +117,11 @@ get_frame_dc (FRAME_PTR f) enter_crit (); hdc = GetDC (f->output_data.w32->window_desc); - select_palette (f, hdc); + + /* If this gets called during startup before the frame is valid, + there is a chance of corrupting random data or crashing. */ + if (hdc) + select_palette (f, hdc); return hdc; } -- 2.39.5