]>
Commit | Line | Data |
---|---|---|
8db0baaa | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.286 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.286 | |
11 | Problem: Crash when using "zd" on a large number of folds. (Sam King) | |
12 | Solution: Recompute pointer after reallocating array. Move fewer entries | |
13 | when making room. | |
14 | Files: src/fold.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.285/src/fold.c 2010-08-15 21:57:27.000000000 +0200 | |
18 | --- src/fold.c 2011-08-26 16:03:56.000000000 +0200 | |
19 | *************** | |
20 | *** 1469,1479 **** | |
21 | } | |
22 | else | |
23 | { | |
24 | ! /* move nested folds one level up, to overwrite the fold that is | |
25 | * deleted. */ | |
26 | moved = fp->fd_nested.ga_len; | |
27 | if (ga_grow(gap, (int)(moved - 1)) == OK) | |
28 | { | |
29 | /* adjust fd_top and fd_flags for the moved folds */ | |
30 | nfp = (fold_T *)fp->fd_nested.ga_data; | |
31 | for (i = 0; i < moved; ++i) | |
32 | --- 1469,1482 ---- | |
33 | } | |
34 | else | |
35 | { | |
36 | ! /* Move nested folds one level up, to overwrite the fold that is | |
37 | * deleted. */ | |
38 | moved = fp->fd_nested.ga_len; | |
39 | if (ga_grow(gap, (int)(moved - 1)) == OK) | |
40 | { | |
41 | + /* Get "fp" again, the array may have been reallocated. */ | |
42 | + fp = (fold_T *)gap->ga_data + idx; | |
43 | + | |
44 | /* adjust fd_top and fd_flags for the moved folds */ | |
45 | nfp = (fold_T *)fp->fd_nested.ga_data; | |
46 | for (i = 0; i < moved; ++i) | |
47 | *************** | |
48 | *** 1486,1494 **** | |
49 | } | |
50 | ||
51 | /* move the existing folds down to make room */ | |
52 | ! if (idx < gap->ga_len) | |
53 | mch_memmove(fp + moved, fp + 1, | |
54 | ! sizeof(fold_T) * (gap->ga_len - idx)); | |
55 | /* move the contained folds one level up */ | |
56 | mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved)); | |
57 | vim_free(nfp); | |
58 | --- 1489,1497 ---- | |
59 | } | |
60 | ||
61 | /* move the existing folds down to make room */ | |
62 | ! if (idx + 1 < gap->ga_len) | |
63 | mch_memmove(fp + moved, fp + 1, | |
64 | ! sizeof(fold_T) * (gap->ga_len - (idx + 1))); | |
65 | /* move the contained folds one level up */ | |
66 | mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved)); | |
67 | vim_free(nfp); | |
68 | *** ../vim-7.3.285/src/version.c 2011-08-19 22:28:58.000000000 +0200 | |
69 | --- src/version.c 2011-08-26 16:07:59.000000000 +0200 | |
70 | *************** | |
71 | *** 711,712 **** | |
72 | --- 711,714 ---- | |
73 | { /* Add new patch number below this line */ | |
74 | + /**/ | |
75 | + 286, | |
76 | /**/ | |
77 | ||
78 | -- | |
79 | To keep milk from turning sour: Keep it in the cow. | |
80 | ||
81 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
82 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
83 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
84 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |