From 19f71add93831ab99c88995b48377ece882c0c77 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 13 Dec 2000 20:28:14 +0000 Subject: [PATCH] (x_free_frame_resources): New function. (x_destroy_window): Use it. --- src/ChangeLog | 11 +++++++++++ src/xterm.c | 45 +++++++++++++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3fdaf7b259c..bb2f8f3f4c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,17 @@ 2000-12-13 Gerd Moellmann + * xfns.c (image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]: + New variables. + (unwind_create_frame, unwind_create_tip_frame): New functions. + (Fx_create_frame, x_create_tip_frame): Handle errors signaled + while a frame is only partially constructed. + + * xterm.h (x_free_frame_resources): Declare. + + * xterm.c (x_free_frame_resources): New function. + (x_destroy_window): Use it. + * dispnew.c (update_window): If do_mouse_tracking is non-nil, don't interrupt the update for pending input initially, i.e. update at least some lines. diff --git a/src/xterm.c b/src/xterm.c index ed1a48b86fc..daf2e90ea95 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12406,11 +12406,12 @@ x_iconify_frame (f) UNBLOCK_INPUT; #endif /* not USE_X_TOOLKIT */ } + -/* Destroy the X window of frame F. */ +/* Free X resources of frame F. */ void -x_destroy_window (f) +x_free_frame_resources (f) struct frame *f; { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -12419,19 +12420,19 @@ x_destroy_window (f) /* If a display connection is dead, don't try sending more commands to the X server. */ - if (dpyinfo->display != 0) + if (dpyinfo->display) { - if (f->output_data.x->icon_desc != 0) + if (f->output_data.x->icon_desc) XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc); + #ifdef HAVE_X_I18N if (FRAME_XIC (f)) free_frame_xic (f); #endif + if (FRAME_X_WINDOW (f)) - { - XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); - FRAME_X_WINDOW (f) = 0; - } + XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); + #ifdef USE_X_TOOLKIT if (f->output_data.x->widget) XtDestroyWidget (f->output_data.x->widget); @@ -12444,6 +12445,7 @@ x_destroy_window (f) unload_color (f, f->output_data.x->cursor_foreground_pixel); unload_color (f, f->output_data.x->border_pixel); unload_color (f, f->output_data.x->mouse_pixel); + if (f->output_data.x->scroll_bar_background_pixel != -1) unload_color (f, f->output_data.x->scroll_bar_background_pixel); if (f->output_data.x->scroll_bar_foreground_pixel != -1) @@ -12453,7 +12455,9 @@ x_destroy_window (f) if (f->output_data.x->black_relief.allocated_p) unload_color (f, f->output_data.x->black_relief.pixel); - free_frame_faces (f); + if (FRAME_FACE_CACHE (f)) + free_frame_faces (f); + x_free_gcs (f); XFlush (FRAME_X_DISPLAY (f)); } @@ -12462,7 +12466,8 @@ x_destroy_window (f) xfree (f->output_data.x->saved_menu_event); xfree (f->output_data.x); - f->output_data.x = 0; + f->output_data.x = NULL; + if (f == dpyinfo->x_focus_frame) dpyinfo->x_focus_frame = 0; if (f == dpyinfo->x_focus_event_frame) @@ -12470,8 +12475,6 @@ x_destroy_window (f) if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - dpyinfo->reference_count--; - if (f == dpyinfo->mouse_face_mouse_frame) { dpyinfo->mouse_face_beg_row @@ -12485,6 +12488,24 @@ x_destroy_window (f) UNBLOCK_INPUT; } + + +/* Destroy the X window of frame F. */ + +void +x_destroy_window (f) + struct frame *f; +{ + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + + /* If a display connection is dead, don't try sending more + commands to the X server. */ + if (dpyinfo->display != 0) + x_free_frame_resources (f); + + dpyinfo->reference_count--; +} + /* Setting window manager hints. */ -- 2.39.2