emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 e8a4d94: Cleanup when opening a new terminal fail


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 e8a4d94: Cleanup when opening a new terminal fails. (Bug#32794)
Date: Sat, 29 Sep 2018 02:34:44 -0400 (EDT)

branch: emacs-26
commit e8a4d942dd7305b85850603c97d987e52510a726
Author: John Shahid <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Cleanup when opening a new terminal fails. (Bug#32794)
    
    * src/term.c (init_tty): Call delete_terminal_internal if emacs_open
    fail.
    * src/terminal.c (delete_terminal): Move some code into
    delete_terminal_internal and call it.
    (delete_terminal_internal): New function.
    * src/termhooks.h: Prototype for delete_terminal_internal.
---
 src/term.c      | 1 +
 src/termhooks.h | 1 +
 src/terminal.c  | 9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/term.c b/src/term.c
index f542fc5..8493cc0 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4004,6 +4004,7 @@ init_tty (const char *name, const char *terminal_type, 
bool must_succeed)
        char const *diagnostic
          = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s";
        emacs_close (fd);
+        delete_terminal_internal (terminal);
        maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name);
       }
 
diff --git a/src/termhooks.h b/src/termhooks.h
index 1b2c95e..543809b 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -729,6 +729,7 @@ extern struct terminal *get_named_terminal (const char *);
 extern struct terminal *create_terminal (enum output_method,
                                         struct redisplay_interface *);
 extern void delete_terminal (struct terminal *);
+extern void delete_terminal_internal (struct terminal *);
 extern Lisp_Object terminal_glyph_code (struct terminal *, int);
 
 /* The initial terminal device, created by initial_term_init.  */
diff --git a/src/terminal.c b/src/terminal.c
index 070b8aa..043ee67 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -314,7 +314,6 @@ create_terminal (enum output_method type, struct 
redisplay_interface *rif)
 void
 delete_terminal (struct terminal *terminal)
 {
-  struct terminal **tp;
   Lisp_Object tail, frame;
 
   /* Protect against recursive calls.  delete_frame calls the
@@ -335,6 +334,14 @@ delete_terminal (struct terminal *terminal)
         }
     }
 
+  delete_terminal_internal (terminal);
+}
+
+void
+delete_terminal_internal (struct terminal *terminal)
+{
+  struct terminal **tp;
+
   for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal)
     if (! *tp)
       emacs_abort ();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]