aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-19 13:00:29 +0000
committerGerd Moellmann2001-04-19 13:00:29 +0000
commita122a38eee71e4541bfca49cecb6ed3b4d824cfe (patch)
tree8df73ce3bc35eed6db559e6d2816d32a540beaa2
parenta2fab450ed26de4c421ef238c42176c8a6a47175 (diff)
downloademacs-a122a38eee71e4541bfca49cecb6ed3b4d824cfe.tar.gz
emacs-a122a38eee71e4541bfca49cecb6ed3b4d824cfe.zip
(delete_kboard): Prevent a dangling reference
from current_kboard to KB, which is freed.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/keyboard.c18
2 files changed, 19 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bf411ea416f..16ed4171305 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12001-04-19 Gerd Moellmann <gerd@gnu.org> 12001-04-19 Gerd Moellmann <gerd@gnu.org>
2 2
3 * keyboard.c (delete_kboard): Prevent a dangling reference
4 from current_kboard to KB, which is freed.
5
3 * process.c (wait_reading_process_input): Call 6 * process.c (wait_reading_process_input): Call
4 record_asynch_buffer_change after running timers, to make 7 record_asynch_buffer_change after running timers, to make
5 read_key_sequence aware of buffer changes from under it. 8 read_key_sequence aware of buffer changes from under it.
diff --git a/src/keyboard.c b/src/keyboard.c
index 1d984be4fcc..a9dd324a381 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10013,19 +10013,33 @@ wipe_kboard (kb)
10013} 10013}
10014 10014
10015#ifdef MULTI_KBOARD 10015#ifdef MULTI_KBOARD
10016
10017/* Free KB and memory referenced from it. */
10018
10016void 10019void
10017delete_kboard (kb) 10020delete_kboard (kb)
10018 KBOARD *kb; 10021 KBOARD *kb;
10019{ 10022{
10020 KBOARD **kbp; 10023 KBOARD **kbp;
10024
10021 for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard) 10025 for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard)
10022 if (*kbp == NULL) 10026 if (*kbp == NULL)
10023 abort (); 10027 abort ();
10024 *kbp = kb->next_kboard; 10028 *kbp = kb->next_kboard;
10029
10030 /* Prevent a dangling reference to KB. */
10031 if (kb == current_kboard)
10032 {
10033 current_kboard = SELECTED_FRAME ()->kboard;
10034 if (current_kboard == kb)
10035 abort ();
10036 }
10037
10025 wipe_kboard (kb); 10038 wipe_kboard (kb);
10026 xfree (kb); 10039 xfree (kb);
10027} 10040}
10028#endif 10041
10042#endif /* MULTI_KBOARD */
10029 10043
10030void 10044void
10031init_keyboard () 10045init_keyboard ()