int is_tooltip_frame;
bool nochild = !FRAME_PARENT_FRAME (f);
Lisp_Object minibuffer_child_frame = Qnil;
+#ifdef HAVE_X_WINDOWS
+ specpdl_ref ref;
+#endif
if (!FRAME_LIVE_P (f))
return Qnil;
/* Clear any X selections for this frame. */
#ifdef HAVE_X_WINDOWS
if (FRAME_X_P (f))
- x_clear_frame_selections (f);
+ {
+ /* Don't preserve selections when a display is going away, since
+ that sends stuff down the wire. */
+
+ ref = SPECPDL_INDEX ();
+
+ if (EQ (force, Qnoelisp))
+ specbind (Qx_auto_preserve_selections, Qnil);
+
+ x_clear_frame_selections (f);
+ unbind_to (ref, Qnil);
+ }
#endif
#ifdef HAVE_PGTK
}
if (x_auto_preserve_selections)
- x_preserve_selections (dpyinfo, lost);
+ x_preserve_selections (dpyinfo, lost, frame);
}
\f
/* True if any properties for DISPLAY and WINDOW
being deleted. */
void
-x_preserve_selections (struct x_display_info *dpyinfo, Lisp_Object lost)
+x_preserve_selections (struct x_display_info *dpyinfo, Lisp_Object lost,
+ Lisp_Object current_owner)
{
Lisp_Object tail, frame, new_owner, tem;
Time timestamp;
FOR_EACH_FRAME (tail, frame)
{
if (FRAME_X_P (XFRAME (frame))
+ && !EQ (frame, current_owner)
&& FRAME_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
{
new_owner = frame;
DEFSYM (Qlatin_1, "latin-1");
DEFSYM (Qnow, "now");
DEFSYM (Qx_dnd_targets_list, "x-dnd-targets-list");
+ DEFSYM (Qx_auto_preserve_selections, "x-auto-preserve-selections");
#ifdef USE_GTK
xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
extern void xic_set_xfontset (struct frame *, const char *);
extern bool x_defined_color (struct frame *, const char *, Emacs_Color *,
bool, bool);
-extern void x_preserve_selections (struct x_display_info *, Lisp_Object);
+extern void x_preserve_selections (struct x_display_info *, Lisp_Object,
+ Lisp_Object);
#ifdef HAVE_X_I18N
extern void free_frame_xic (struct frame *);
# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT