From c6ea27758c3c7e98dd2b60c7697ad970e9a002a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 6 Dec 2001 11:56:53 +0000 Subject: [PATCH] (x_free_frame_resources) [USE_X_TOOLKIT]: Remove all the scroll bars of the frame before deleting the frame itself. If the frame has a widget, delete the frame with XtDestroyWidget, and do not call XDestroyWindow before that. --- src/ChangeLog | 7 +++++++ src/xterm.c | 33 ++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e9efc65e9b7..bc80158cf81 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-12-06 Eli Zaretskii + + * xterm.c (x_free_frame_resources) [USE_X_TOOLKIT]: Remove all the + scroll bars of the frame before deleting the frame itself. If the + frame has a widget, delete the frame with XtDestroyWidget, and do + not call XDestroyWindow before that. + 2001-12-06 Kim F. Storm * xfns.c (x_report_frame_params): Return actual fringe widths. diff --git a/src/xterm.c b/src/xterm.c index db255f07659..51b94c9fb37 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13219,6 +13219,8 @@ x_free_frame_resources (f) struct frame *f; { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Lisp_Object bar; + struct scroll_bar *b; BLOCK_INPUT; @@ -13228,23 +13230,40 @@ x_free_frame_resources (f) { if (f->output_data.x->icon_desc) XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc); - + +#ifdef USE_X_TOOLKIT + /* Explicitly destroy the scroll bars of the frame. Without + this, we get "BadDrawable" errors from the toolkit later on, + presumably from expose events generated for the disappearing + toolkit scroll bars. */ + for (bar = FRAME_SCROLL_BARS (f); !NILP (bar); bar = b->next) + { + b = XSCROLL_BAR (bar); + x_scroll_bar_remove (b); + } +#endif + #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)); - + #ifdef USE_X_TOOLKIT if (f->output_data.x->widget) { XtDestroyWidget (f->output_data.x->widget); f->output_data.x->widget = NULL; } + /* Tooltips don't have widgets, only a simple X window, even if + we are using a toolkit. */ + else if (FRAME_X_WINDOW (f)) + XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); + free_frame_menubar (f); -#endif /* USE_X_TOOLKIT */ +#else /* !USE_X_TOOLKIT */ + if (FRAME_X_WINDOW (f)) + XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); +#endif /* !USE_X_TOOLKIT */ unload_color (f, f->output_data.x->foreground_pixel); unload_color (f, f->output_data.x->background_pixel); @@ -13252,7 +13271,7 @@ x_free_frame_resources (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) -- 2.39.5