aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
authorChong Yidong2011-06-04 18:08:32 -0400
committerChong Yidong2011-06-04 18:08:32 -0400
commitde65b42cbf9d2d0fb200a6115ae092b8eff1cb25 (patch)
treeac3b8da595f7a79740cd1cdd688f592662234ff8 /src/xselect.c
parent4b80f6746dc824f1ec36a96abe684480ed06e62e (diff)
downloademacs-de65b42cbf9d2d0fb200a6115ae092b8eff1cb25.tar.gz
emacs-de65b42cbf9d2d0fb200a6115ae092b8eff1cb25.zip
* src/xselect.c (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 4e7c28fc9d8..00d70eee477 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1207,7 +1207,6 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1207 ? symbol_to_x_atom (dpyinfo, XCAR (target_type)) 1207 ? symbol_to_x_atom (dpyinfo, XCAR (target_type))
1208 : symbol_to_x_atom (dpyinfo, target_type)); 1208 : symbol_to_x_atom (dpyinfo, target_type));
1209 int secs, usecs; 1209 int secs, usecs;
1210 int count = SPECPDL_INDEX ();
1211 1210
1212 if (!FRAME_LIVE_P (f)) 1211 if (!FRAME_LIVE_P (f))
1213 return Qnil; 1212 return Qnil;
@@ -1225,20 +1224,15 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1225 } 1224 }
1226 1225
1227 BLOCK_INPUT; 1226 BLOCK_INPUT;
1228
1229 /* The protected block contains wait_reading_process_output, which
1230 can run random lisp code (process handlers) or signal.
1231 Therefore, we put the x_uncatch_errors call in an unwind. */
1232 record_unwind_protect (x_catch_errors_unwind, Qnil);
1233 x_catch_errors (display);
1234
1235 TRACE2 ("Get selection %s, type %s", 1227 TRACE2 ("Get selection %s, type %s",
1236 XGetAtomName (display, type_atom), 1228 XGetAtomName (display, type_atom),
1237 XGetAtomName (display, target_property)); 1229 XGetAtomName (display, target_property));
1238 1230
1231 x_catch_errors (display);
1239 XConvertSelection (display, selection_atom, type_atom, target_property, 1232 XConvertSelection (display, selection_atom, type_atom, target_property,
1240 requestor_window, requestor_time); 1233 requestor_window, requestor_time);
1241 XFlush (display); 1234 x_check_errors (display, "Can't convert selection: %s");
1235 x_uncatch_errors ();
1242 1236
1243 /* Prepare to block until the reply has been read. */ 1237 /* Prepare to block until the reply has been read. */
1244 reading_selection_window = requestor_window; 1238 reading_selection_window = requestor_window;
@@ -1264,13 +1258,6 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1264 reading_selection_reply, NULL, 0); 1258 reading_selection_reply, NULL, 0);
1265 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); 1259 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply)));
1266 1260
1267 BLOCK_INPUT;
1268 if (x_had_errors_p (display))
1269 error ("Cannot get selection");
1270 /* This calls x_uncatch_errors. */
1271 unbind_to (count, Qnil);
1272 UNBLOCK_INPUT;
1273
1274 if (NILP (XCAR (reading_selection_reply))) 1261 if (NILP (XCAR (reading_selection_reply)))
1275 error ("Timed out waiting for reply from selection owner"); 1262 error ("Timed out waiting for reply from selection owner");
1276 if (EQ (XCAR (reading_selection_reply), Qlambda)) 1263 if (EQ (XCAR (reading_selection_reply), Qlambda))