comparison src/xterm.c @ 41837:ca8e9acfffca

(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.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 06 Dec 2001 11:56:31 +0000
parents fcab0e888c5c
children 0f4506820432
comparison
equal deleted inserted replaced
41836:09535ed6868f 41837:ca8e9acfffca
13217 void 13217 void
13218 x_free_frame_resources (f) 13218 x_free_frame_resources (f)
13219 struct frame *f; 13219 struct frame *f;
13220 { 13220 {
13221 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 13221 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
13222 Lisp_Object bar;
13223 struct scroll_bar *b;
13222 13224
13223 BLOCK_INPUT; 13225 BLOCK_INPUT;
13224 13226
13225 /* If a display connection is dead, don't try sending more 13227 /* If a display connection is dead, don't try sending more
13226 commands to the X server. */ 13228 commands to the X server. */
13227 if (dpyinfo->display) 13229 if (dpyinfo->display)
13228 { 13230 {
13229 if (f->output_data.x->icon_desc) 13231 if (f->output_data.x->icon_desc)
13230 XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc); 13232 XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc);
13231 13233
13234 #ifdef USE_X_TOOLKIT
13235 /* Explicitly destroy the scroll bars of the frame. Without
13236 this, we get "BadDrawable" errors from the toolkit later on,
13237 presumably from expose events generated for the disappearing
13238 toolkit scroll bars. */
13239 for (bar = FRAME_SCROLL_BARS (f); !NILP (bar); bar = b->next)
13240 {
13241 b = XSCROLL_BAR (bar);
13242 x_scroll_bar_remove (b);
13243 }
13244 #endif
13245
13232 #ifdef HAVE_X_I18N 13246 #ifdef HAVE_X_I18N
13233 if (FRAME_XIC (f)) 13247 if (FRAME_XIC (f))
13234 free_frame_xic (f); 13248 free_frame_xic (f);
13235 #endif 13249 #endif
13236 13250
13237 if (FRAME_X_WINDOW (f))
13238 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
13239
13240 #ifdef USE_X_TOOLKIT 13251 #ifdef USE_X_TOOLKIT
13241 if (f->output_data.x->widget) 13252 if (f->output_data.x->widget)
13242 { 13253 {
13243 XtDestroyWidget (f->output_data.x->widget); 13254 XtDestroyWidget (f->output_data.x->widget);
13244 f->output_data.x->widget = NULL; 13255 f->output_data.x->widget = NULL;
13245 } 13256 }
13257 /* Tooltips don't have widgets, only a simple X window, even if
13258 we are using a toolkit. */
13259 else if (FRAME_X_WINDOW (f))
13260 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
13261
13246 free_frame_menubar (f); 13262 free_frame_menubar (f);
13247 #endif /* USE_X_TOOLKIT */ 13263 #else /* !USE_X_TOOLKIT */
13264 if (FRAME_X_WINDOW (f))
13265 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
13266 #endif /* !USE_X_TOOLKIT */
13248 13267
13249 unload_color (f, f->output_data.x->foreground_pixel); 13268 unload_color (f, f->output_data.x->foreground_pixel);
13250 unload_color (f, f->output_data.x->background_pixel); 13269 unload_color (f, f->output_data.x->background_pixel);
13251 unload_color (f, f->output_data.x->cursor_pixel); 13270 unload_color (f, f->output_data.x->cursor_pixel);
13252 unload_color (f, f->output_data.x->cursor_foreground_pixel); 13271 unload_color (f, f->output_data.x->cursor_foreground_pixel);
13253 unload_color (f, f->output_data.x->border_pixel); 13272 unload_color (f, f->output_data.x->border_pixel);
13254 unload_color (f, f->output_data.x->mouse_pixel); 13273 unload_color (f, f->output_data.x->mouse_pixel);
13255 13274
13256 if (f->output_data.x->scroll_bar_background_pixel != -1) 13275 if (f->output_data.x->scroll_bar_background_pixel != -1)
13257 unload_color (f, f->output_data.x->scroll_bar_background_pixel); 13276 unload_color (f, f->output_data.x->scroll_bar_background_pixel);
13258 if (f->output_data.x->scroll_bar_foreground_pixel != -1) 13277 if (f->output_data.x->scroll_bar_foreground_pixel != -1)
13259 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); 13278 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel);
13260 #ifdef USE_TOOLKIT_SCROLL_BARS 13279 #ifdef USE_TOOLKIT_SCROLL_BARS