diff options
| author | Eli Zaretskii | 2011-08-05 14:04:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-08-05 14:04:44 +0300 |
| commit | 5009803bda518652cc6f4b9fba02c0aed185c2a3 (patch) | |
| tree | 5d0443887455129a793cadd52f03f740ec5230da /src/window.c | |
| parent | e2e2423bf2fe3cda60737f20aeafaff64d38b35e (diff) | |
| parent | 35928349678bc6ed8f621fe7d4da6a9a3fb3579d (diff) | |
| download | emacs-5009803bda518652cc6f4b9fba02c0aed185c2a3.tar.gz emacs-5009803bda518652cc6f4b9fba02c0aed185c2a3.zip | |
Fix bug #9221 with memory leak in bidi display.
Add code to monitor memory allocation for bidi cache shelving.
src/xdisp.c (display_line): Release buffer allocated for shelved bidi
cache.
src/bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total
amount allocated this far in `bidi_cache_total_alloc'.
(bidi_unshelve_cache): Accept an additional argument JUST_FREE; if
non-zero, only free the data buffer without restoring the cache
contents. All callers changed.
src/dispextern.h (bidi_unshelve_cache): Update prototype.
src/xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to)
(move_it_in_display_line, move_it_to)
(move_it_vertically_backward, move_it_by_lines): Replace the call
to xfree to an equivalent call to bidi_unshelve_cache.
(move_it_in_display_line_to): Fix logic of returning
MOVE_POS_MATCH_OR_ZV in the bidi case.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c index 3f5a743f5c6..8df4a857851 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1379,7 +1379,7 @@ if it isn't already recorded. */) | |||
| 1379 | if (it.current_y < it.last_visible_y) | 1379 | if (it.current_y < it.last_visible_y) |
| 1380 | move_it_past_eol (&it); | 1380 | move_it_past_eol (&it); |
| 1381 | value = make_number (IT_CHARPOS (it)); | 1381 | value = make_number (IT_CHARPOS (it)); |
| 1382 | bidi_unshelve_cache (itdata); | 1382 | bidi_unshelve_cache (itdata, 0); |
| 1383 | 1383 | ||
| 1384 | if (old_buffer) | 1384 | if (old_buffer) |
| 1385 | set_buffer_internal (old_buffer); | 1385 | set_buffer_internal (old_buffer); |
| @@ -4273,7 +4273,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4273 | } | 4273 | } |
| 4274 | 4274 | ||
| 4275 | start = it.current.pos; | 4275 | start = it.current.pos; |
| 4276 | bidi_unshelve_cache (itdata); | 4276 | bidi_unshelve_cache (itdata, 0); |
| 4277 | } | 4277 | } |
| 4278 | else if (auto_window_vscroll_p) | 4278 | else if (auto_window_vscroll_p) |
| 4279 | { | 4279 | { |
| @@ -4417,7 +4417,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4417 | } | 4417 | } |
| 4418 | else | 4418 | else |
| 4419 | { | 4419 | { |
| 4420 | bidi_unshelve_cache (itdata); | 4420 | bidi_unshelve_cache (itdata, 0); |
| 4421 | if (noerror) | 4421 | if (noerror) |
| 4422 | return; | 4422 | return; |
| 4423 | else if (n < 0) /* could happen with empty buffers */ | 4423 | else if (n < 0) /* could happen with empty buffers */ |
| @@ -4434,7 +4434,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4434 | w->vscroll = 0; | 4434 | w->vscroll = 0; |
| 4435 | else | 4435 | else |
| 4436 | { | 4436 | { |
| 4437 | bidi_unshelve_cache (itdata); | 4437 | bidi_unshelve_cache (itdata, 0); |
| 4438 | if (noerror) | 4438 | if (noerror) |
| 4439 | return; | 4439 | return; |
| 4440 | else | 4440 | else |
| @@ -4583,7 +4583,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4583 | SET_PT_BOTH (charpos, bytepos); | 4583 | SET_PT_BOTH (charpos, bytepos); |
| 4584 | } | 4584 | } |
| 4585 | } | 4585 | } |
| 4586 | bidi_unshelve_cache (itdata); | 4586 | bidi_unshelve_cache (itdata, 0); |
| 4587 | } | 4587 | } |
| 4588 | 4588 | ||
| 4589 | 4589 | ||
| @@ -5010,7 +5010,7 @@ displayed_window_lines (struct window *w) | |||
| 5010 | start_display (&it, w, start); | 5010 | start_display (&it, w, start); |
| 5011 | move_it_vertically (&it, height); | 5011 | move_it_vertically (&it, height); |
| 5012 | bottom_y = line_bottom_y (&it); | 5012 | bottom_y = line_bottom_y (&it); |
| 5013 | bidi_unshelve_cache (itdata); | 5013 | bidi_unshelve_cache (itdata, 0); |
| 5014 | 5014 | ||
| 5015 | /* rms: On a non-window display, | 5015 | /* rms: On a non-window display, |
| 5016 | the value of it.vpos at the bottom of the screen | 5016 | the value of it.vpos at the bottom of the screen |
| @@ -5116,7 +5116,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5116 | move_it_vertically_backward (&it, window_box_height (w) / 2); | 5116 | move_it_vertically_backward (&it, window_box_height (w) / 2); |
| 5117 | charpos = IT_CHARPOS (it); | 5117 | charpos = IT_CHARPOS (it); |
| 5118 | bytepos = IT_BYTEPOS (it); | 5118 | bytepos = IT_BYTEPOS (it); |
| 5119 | bidi_unshelve_cache (itdata); | 5119 | bidi_unshelve_cache (itdata, 0); |
| 5120 | } | 5120 | } |
| 5121 | else if (iarg < 0) | 5121 | else if (iarg < 0) |
| 5122 | { | 5122 | { |
| @@ -5164,7 +5164,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5164 | } | 5164 | } |
| 5165 | if (h <= 0) | 5165 | if (h <= 0) |
| 5166 | { | 5166 | { |
| 5167 | bidi_unshelve_cache (itdata); | 5167 | bidi_unshelve_cache (itdata, 0); |
| 5168 | return Qnil; | 5168 | return Qnil; |
| 5169 | } | 5169 | } |
| 5170 | 5170 | ||
| @@ -5187,7 +5187,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5187 | charpos = IT_CHARPOS (it); | 5187 | charpos = IT_CHARPOS (it); |
| 5188 | bytepos = IT_BYTEPOS (it); | 5188 | bytepos = IT_BYTEPOS (it); |
| 5189 | 5189 | ||
| 5190 | bidi_unshelve_cache (itdata); | 5190 | bidi_unshelve_cache (itdata, 0); |
| 5191 | } | 5191 | } |
| 5192 | else | 5192 | else |
| 5193 | { | 5193 | { |