}
static void
-x_dnd_free_toplevels (void)
+x_dnd_free_toplevels (bool display_alive)
{
struct x_client_list_window *last;
struct x_client_list_window *tem = x_dnd_toplevels;
last = tem;
tem = tem->next;
- x_catch_errors (last->dpy);
- XSelectInput (last->dpy, last->window,
- last->previous_event_mask);
+ if (display_alive)
+ {
+ x_catch_errors (last->dpy);
+ XSelectInput (last->dpy, last->window,
+ last->previous_event_mask);
#ifdef HAVE_XSHAPE
- XShapeSelectInput (last->dpy, last->window, None);
+ XShapeSelectInput (last->dpy, last->window, None);
#endif
- x_uncatch_errors ();
+ x_uncatch_errors ();
+ }
#ifdef HAVE_XSHAPE
if (last->n_input_rects != -1)
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
FRAME_DISPLAY_INFO (f)->grabbed = 0;
#ifdef USE_GTK
{
if (x_dnd_compute_toplevels (FRAME_DISPLAY_INFO (f)))
{
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
x_dnd_use_toplevels = false;
}
}
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
x_dnd_return_frame_object = NULL;
x_dnd_movement_frame = NULL;
x_dnd_return_frame_object = NULL;
if (x_dnd_use_toplevels)
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
FRAME_DISPLAY_INFO (f)->grabbed = 0;
/* Emacs can't respond to DND events inside the nested event
{
if (x_dnd_use_toplevels)
{
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
if (x_dnd_compute_toplevels (dpyinfo))
{
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (true);
x_dnd_use_toplevels = false;
}
}
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (false);
x_dnd_return_frame_object = NULL;
x_dnd_movement_frame = NULL;
x_dnd_in_progress = false;
x_dnd_waiting_for_finish = false;
+ /* The display is going away, so there's no point in
+ de-selecting for input on the DND toplevels. */
if (x_dnd_use_toplevels)
- x_dnd_free_toplevels ();
+ x_dnd_free_toplevels (false);
x_dnd_return_frame_object = NULL;
x_dnd_movement_frame = NULL;