Mercurial > emacs
comparison src/term.c @ 83050:85e5a786f728
Don't delete a tty if it's the last device with frames.
src/term.c (delete_tty): Signal an error if this is the last display
with live frames. Reported by Dan Nicolaescu.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-90
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 20 Feb 2004 17:51:35 +0000 |
parents | 94b1d2cd8189 |
children | a871be7b26a5 |
comparison
equal
deleted
inserted
replaced
83049:b8aef5cd0bf2 | 83050:85e5a786f728 |
---|---|
77 static void turn_off_face P_ ((struct frame *, int face_id)); | 77 static void turn_off_face P_ ((struct frame *, int face_id)); |
78 static void tty_show_cursor P_ ((struct tty_display_info *)); | 78 static void tty_show_cursor P_ ((struct tty_display_info *)); |
79 static void tty_hide_cursor P_ ((struct tty_display_info *)); | 79 static void tty_hide_cursor P_ ((struct tty_display_info *)); |
80 | 80 |
81 void delete_initial_display P_ ((struct display *)); | 81 void delete_initial_display P_ ((struct display *)); |
82 void delete_tty P_ ((struct display *)); | |
83 void create_tty_output P_ ((struct frame *)); | 82 void create_tty_output P_ ((struct frame *)); |
84 void delete_tty_output P_ ((struct frame *)); | 83 void delete_tty_output P_ ((struct frame *)); |
85 | 84 |
86 #define OUTPUT(tty, a) \ | 85 #define OUTPUT(tty, a) \ |
87 emacs_tputs ((tty), a, \ | 86 emacs_tputs ((tty), a, \ |
2866 delete_tty (struct display *display) | 2865 delete_tty (struct display *display) |
2867 { | 2866 { |
2868 struct tty_display_info *tty; | 2867 struct tty_display_info *tty; |
2869 Lisp_Object tail, frame; | 2868 Lisp_Object tail, frame; |
2870 char *tty_name; | 2869 char *tty_name; |
2870 int last_display; | |
2871 | 2871 |
2872 if (deleting_tty) | 2872 if (deleting_tty) |
2873 /* We get a recursive call when we delete the last frame on this | 2873 /* We get a recursive call when we delete the last frame on this |
2874 display. */ | 2874 display. */ |
2875 return; | 2875 return; |
2876 | 2876 |
2877 deleting_tty = 1; | |
2878 | |
2879 if (display->type != output_termcap) | 2877 if (display->type != output_termcap) |
2880 abort (); | 2878 abort (); |
2881 | 2879 |
2882 tty = display->display_info.tty; | 2880 tty = display->display_info.tty; |
2881 | |
2882 last_display = 1; | |
2883 FOR_EACH_FRAME (tail, frame) | |
2884 { | |
2885 struct frame *f = XFRAME (frame); | |
2886 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) | |
2887 { | |
2888 last_display = 0; | |
2889 break; | |
2890 } | |
2891 } | |
2892 if (last_display) | |
2893 error ("Attempt to delete the sole display with live frames"); | |
2883 | 2894 |
2884 if (tty == tty_list) | 2895 if (tty == tty_list) |
2885 tty_list = tty->next; | 2896 tty_list = tty->next; |
2886 else | 2897 else |
2887 { | 2898 { |
2894 abort (); | 2905 abort (); |
2895 | 2906 |
2896 p->next = tty->next; | 2907 p->next = tty->next; |
2897 tty->next = 0; | 2908 tty->next = 0; |
2898 } | 2909 } |
2910 | |
2911 deleting_tty = 1; | |
2899 | 2912 |
2900 FOR_EACH_FRAME (tail, frame) | 2913 FOR_EACH_FRAME (tail, frame) |
2901 { | 2914 { |
2902 struct frame *f = XFRAME (frame); | 2915 struct frame *f = XFRAME (frame); |
2903 if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty) | 2916 if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty) |