aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.c
diff options
context:
space:
mode:
authorKaroly Lorentey <[email protected]>2005-12-30 05:28:31 +0000
committerKaroly Lorentey <[email protected]>2005-12-30 05:28:31 +0000
commitea161626590293c1128cb327f1111a3c1500fe65 (patch)
treef310e6bea1c22e517c2eb0ba88c9e48d8b0683e0 /src/frame.c
parent27d8b4bf36cd29b138d2263594e4cd2311104b12 (diff)
Make sure `delete-frame-functions' can not prevent the frame from being deleted.
* frame.c (delete_frame_handler): New function. (Fdelete_frame): Use it to invoke `delete-frame-functions' safely. git-archimport-id: [email protected]/emacs--multi-tty--0--patch-475
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/frame.c b/src/frame.c
index bc358c702b..f573ef02b5 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1324,6 +1324,14 @@ other_visible_frames (f)
return 1;
}
+/* Error handler for `delete-frame-functions'. */
+static Lisp_Object
+delete_frame_handler (Lisp_Object arg)
+{
+ add_to_log ("Error during `delete-frame': %s", arg, Qnil);
+ return Qnil;
+}
+
DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "",
doc: /* Delete FRAME, permanently eliminating it from use.
If omitted, FRAME defaults to the selected frame.
@@ -1398,10 +1406,18 @@ The functions are run with one arg, the frame to be deleted. */)
if (!NILP (Vrun_hooks)
&& NILP (Fframe_parameter (frame, intern ("tooltip"))))
{
+ int count = SPECPDL_INDEX ();
Lisp_Object args[2];
+ struct gcpro gcpro1, gcpro2;
+
+ /* Don't let a rogue function in `delete-frame-functions'
+ prevent the frame deletion. */
+ GCPRO2 (args[0], args[1]);
args[0] = intern ("delete-frame-functions");
args[1] = frame;
- Frun_hook_with_args (2, args);
+ internal_condition_case_2 (Frun_hook_with_args, 2, args,
+ Qt, delete_frame_handler);
+ UNGCPRO;
}
/* The hook may sometimes (indirectly) cause the frame to be deleted. */