diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c index 4da5b451d0f..d948aaa2662 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -937,19 +937,16 @@ delete_all_overlays (struct buffer *b) | |||
| 937 | if (! b->overlays) | 937 | if (! b->overlays) |
| 938 | return; | 938 | return; |
| 939 | 939 | ||
| 940 | /* FIXME: This loop sets the overlays' `buffer` field to NULL but | 940 | /* The general rule is that the tree cannot be modified from within |
| 941 | doesn't set the itree_nodes' `parent`, `left` and `right` | 941 | ITREE_FOREACH, but here we bend this rule a little because we know |
| 942 | fields accordingly. I believe it's harmless, but a bit untidy since | 942 | that the POST_ORDER iterator will not need to look at `node` again. */ |
| 943 | other parts of the code are careful to set those fields to NULL when | 943 | ITREE_FOREACH (node, b->overlays, PTRDIFF_MIN, PTRDIFF_MAX, POST_ORDER) |
| 944 | the overlay is deleted. | ||
| 945 | Of course, we can't set them to NULL from within the iteration | ||
| 946 | because the iterator may need them (tho we could if we added | ||
| 947 | an ITREE_POST_ORDER iteration order). */ | ||
| 948 | ITREE_FOREACH (node, b->overlays, PTRDIFF_MIN, PTRDIFF_MAX, ASCENDING) | ||
| 949 | { | 944 | { |
| 950 | modify_overlay (b, node->begin, node->end); | 945 | modify_overlay (b, node->begin, node->end); |
| 951 | /* Where are the nodes freed ? --ap */ | ||
| 952 | XOVERLAY (node->data)->buffer = NULL; | 946 | XOVERLAY (node->data)->buffer = NULL; |
| 947 | node->parent = NULL; | ||
| 948 | node->left = NULL; | ||
| 949 | node->right = NULL; | ||
| 953 | } | 950 | } |
| 954 | itree_clear (b->overlays); | 951 | itree_clear (b->overlays); |
| 955 | } | 952 | } |