* src/xselect.c (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).

This commit is contained in:
Chong Yidong 2011-06-04 18:08:32 -04:00
parent 4b80f6746d
commit de65b42cbf
2 changed files with 4 additions and 16 deletions

View file

@ -8,6 +8,7 @@
Obey Vx_select_enable_clipboard_manager. Catch errors in
x_clipboard_manager_save (Bug#8779).
(Vx_select_enable_clipboard_manager): New variable.
(x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
2011-06-04 Dan Nicolaescu <dann@ics.uci.edu>

View file

@ -1207,7 +1207,6 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
? symbol_to_x_atom (dpyinfo, XCAR (target_type))
: symbol_to_x_atom (dpyinfo, target_type));
int secs, usecs;
int count = SPECPDL_INDEX ();
if (!FRAME_LIVE_P (f))
return Qnil;
@ -1225,20 +1224,15 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
}
BLOCK_INPUT;
/* The protected block contains wait_reading_process_output, which
can run random lisp code (process handlers) or signal.
Therefore, we put the x_uncatch_errors call in an unwind. */
record_unwind_protect (x_catch_errors_unwind, Qnil);
x_catch_errors (display);
TRACE2 ("Get selection %s, type %s",
XGetAtomName (display, type_atom),
XGetAtomName (display, target_property));
x_catch_errors (display);
XConvertSelection (display, selection_atom, type_atom, target_property,
requestor_window, requestor_time);
XFlush (display);
x_check_errors (display, "Can't convert selection: %s");
x_uncatch_errors ();
/* Prepare to block until the reply has been read. */
reading_selection_window = requestor_window;
@ -1264,13 +1258,6 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
reading_selection_reply, NULL, 0);
TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply)));
BLOCK_INPUT;
if (x_had_errors_p (display))
error ("Cannot get selection");
/* This calls x_uncatch_errors. */
unbind_to (count, Qnil);
UNBLOCK_INPUT;
if (NILP (XCAR (reading_selection_reply)))
error ("Timed out waiting for reply from selection owner");
if (EQ (XCAR (reading_selection_reply), Qlambda))