diff options
| author | Po Lu | 2022-07-04 12:56:24 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-04 12:56:42 +0800 |
| commit | bd034b342ccf15a1887614f19de1caa9ff2f2d22 (patch) | |
| tree | 72c78dd4c8b2a616e060297469f84b5834624230 /src | |
| parent | 3f2af38ef844e29ab31e5d30e3ccee91a33f6b99 (diff) | |
| download | emacs-bd034b342ccf15a1887614f19de1caa9ff2f2d22.tar.gz emacs-bd034b342ccf15a1887614f19de1caa9ff2f2d22.zip | |
Fix accessing dpyinfo after it is deallocated
* src/xterm.c (x_connection_closed): Print disconnect error for
the last terminal before freeing it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/xterm.c b/src/xterm.c index c5acb450837..6a357b473d6 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -23501,43 +23501,47 @@ For details, see etc/PROBLEMS.\n", | |||
| 23501 | /* We have just closed all frames on this display. */ | 23501 | /* We have just closed all frames on this display. */ |
| 23502 | emacs_abort (); | 23502 | emacs_abort (); |
| 23503 | 23503 | ||
| 23504 | XSETTERMINAL (tmp, dpyinfo->terminal); | 23504 | /* This was the last terminal remaining, so print the error |
| 23505 | Fdelete_terminal (tmp, Qnoelisp); | 23505 | message and associated error handlers and kill Emacs. */ |
| 23506 | } | 23506 | if (dpyinfo->terminal == terminal_list |
| 23507 | 23507 | && !terminal_list->next_terminal) | |
| 23508 | unblock_input (); | 23508 | { |
| 23509 | fprintf (stderr, "%s\n", error_msg); | ||
| 23509 | 23510 | ||
| 23510 | if (terminal_list == 0) | 23511 | if (!ioerror && dpyinfo) |
| 23511 | { | 23512 | { |
| 23512 | fprintf (stderr, "%s\n", error_msg); | 23513 | /* Dump the list of error handlers for debugging |
| 23514 | purposes. */ | ||
| 23513 | 23515 | ||
| 23514 | if (!ioerror) | 23516 | fprintf (stderr, "X error handlers currently installed:\n"); |
| 23515 | { | ||
| 23516 | /* Dump the list of error handlers for debugging | ||
| 23517 | purposes. */ | ||
| 23518 | 23517 | ||
| 23519 | fprintf (stderr, "X error handlers currently installed:\n"); | 23518 | for (failable = dpyinfo->failable_requests; |
| 23519 | failable < dpyinfo->next_failable_request; | ||
| 23520 | ++failable) | ||
| 23521 | { | ||
| 23522 | if (failable->end) | ||
| 23523 | fprintf (stderr, "Ignoring errors between %lu to %lu\n", | ||
| 23524 | failable->start, failable->end); | ||
| 23525 | else | ||
| 23526 | fprintf (stderr, "Ignoring errors from %lu onwards\n", | ||
| 23527 | failable->start); | ||
| 23528 | } | ||
| 23520 | 23529 | ||
| 23521 | for (failable = dpyinfo->failable_requests; | 23530 | for (stack = x_error_message; stack; stack = stack->prev) |
| 23522 | failable < dpyinfo->next_failable_request; | 23531 | fprintf (stderr, "Trapping errors from %lu\n", |
| 23523 | ++failable) | 23532 | stack->first_request); |
| 23524 | { | ||
| 23525 | if (failable->end) | ||
| 23526 | fprintf (stderr, "Ignoring errors between %lu to %lu\n", | ||
| 23527 | failable->start, failable->end); | ||
| 23528 | else | ||
| 23529 | fprintf (stderr, "Ignoring errors from %lu onwards\n", | ||
| 23530 | failable->start); | ||
| 23531 | } | 23533 | } |
| 23532 | |||
| 23533 | for (stack = x_error_message; stack; stack = stack->prev) | ||
| 23534 | fprintf (stderr, "Trapping errors from %lu\n", | ||
| 23535 | stack->first_request); | ||
| 23536 | } | 23534 | } |
| 23537 | 23535 | ||
| 23538 | Fkill_emacs (make_fixnum (70), Qnil); | 23536 | XSETTERMINAL (tmp, dpyinfo->terminal); |
| 23537 | Fdelete_terminal (tmp, Qnoelisp); | ||
| 23539 | } | 23538 | } |
| 23540 | 23539 | ||
| 23540 | unblock_input (); | ||
| 23541 | |||
| 23542 | if (terminal_list == 0) | ||
| 23543 | Fkill_emacs (make_fixnum (70), Qnil); | ||
| 23544 | |||
| 23541 | totally_unblock_input (); | 23545 | totally_unblock_input (); |
| 23542 | 23546 | ||
| 23543 | unbind_to (idx, Qnil); | 23547 | unbind_to (idx, Qnil); |