]>
Commit | Line | Data |
---|---|---|
05649561 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.250 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.250 | |
11 | Problem: Memory leaks when using signs. (Xavier de Gaye) | |
12 | Solution: Delete the list of signs when unloading a buffer. | |
13 | Files: src/buffer.c | |
14 | ||
15 | ||
16 | *** ../vim-6.2.249/src/buffer.c Sun Jan 18 20:58:01 2004 | |
17 | --- src/buffer.c Tue Feb 10 15:50:40 2004 | |
18 | *************** | |
19 | *** 55,60 **** | |
20 | --- 55,65 ---- | |
21 | # define dev_T unsigned | |
22 | #endif | |
23 | ||
24 | + #if defined(FEAT_SIGNS) | |
25 | + static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr)); | |
26 | + static void buf_delete_signs __ARGS((buf_T *buf)); | |
27 | + #endif | |
28 | + | |
29 | /* | |
30 | * Open current buffer, that is: open the memfile and read the file into memory | |
31 | * return FAIL for failure, OK otherwise | |
32 | *************** | |
33 | *** 559,564 **** | |
34 | --- 564,572 ---- | |
35 | #ifdef FEAT_SYN_HL | |
36 | syntax_clear(buf); /* reset syntax info */ | |
37 | #endif | |
38 | + #ifdef FEAT_SIGNS | |
39 | + buf_delete_signs(buf); /* delete any signs */ | |
40 | + #endif | |
41 | } | |
42 | ||
43 | /* | |
44 | *************** | |
45 | *** 4557,4565 **** | |
46 | ||
47 | ||
48 | #if defined(FEAT_SIGNS) || defined(PROTO) | |
49 | - | |
50 | - static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr)); | |
51 | - | |
52 | /* | |
53 | * Insert the sign into the signlist. | |
54 | */ | |
55 | --- 4565,4570 ---- | |
56 | *************** | |
57 | *** 4822,4845 **** | |
58 | # endif /* FEAT_NETBEANS_INTG */ | |
59 | ||
60 | ||
61 | void | |
62 | buf_delete_all_signs() | |
63 | { | |
64 | buf_T *buf; /* buffer we are checking for signs */ | |
65 | - signlist_T *sign; /* a sign in a b_signlist */ | |
66 | - signlist_T *next; /* the next sign in a b_signlist */ | |
67 | ||
68 | for (buf = firstbuf; buf != NULL; buf = buf->b_next) | |
69 | if (buf->b_signlist != NULL) | |
70 | { | |
71 | /* Need to redraw the windows to remove the sign column. */ | |
72 | redraw_buf_later(buf, NOT_VALID); | |
73 | ! for (sign = buf->b_signlist; sign != NULL; sign = next) | |
74 | ! { | |
75 | ! next = sign->next; | |
76 | ! vim_free(sign); | |
77 | ! } | |
78 | ! buf->b_signlist = NULL; | |
79 | } | |
80 | } | |
81 | ||
82 | --- 4827,4863 ---- | |
83 | # endif /* FEAT_NETBEANS_INTG */ | |
84 | ||
85 | ||
86 | + /* | |
87 | + * Delete signs in buffer "buf". | |
88 | + */ | |
89 | + static void | |
90 | + buf_delete_signs(buf) | |
91 | + buf_T *buf; | |
92 | + { | |
93 | + signlist_T *next; | |
94 | + | |
95 | + while (buf->b_signlist != NULL) | |
96 | + { | |
97 | + next = buf->b_signlist->next; | |
98 | + vim_free(buf->b_signlist); | |
99 | + buf->b_signlist = next; | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + /* | |
104 | + * Delete all signs in all buffers. | |
105 | + */ | |
106 | void | |
107 | buf_delete_all_signs() | |
108 | { | |
109 | buf_T *buf; /* buffer we are checking for signs */ | |
110 | ||
111 | for (buf = firstbuf; buf != NULL; buf = buf->b_next) | |
112 | if (buf->b_signlist != NULL) | |
113 | { | |
114 | /* Need to redraw the windows to remove the sign column. */ | |
115 | redraw_buf_later(buf, NOT_VALID); | |
116 | ! buf_delete_signs(buf); | |
117 | } | |
118 | } | |
119 | ||
120 | *** ../vim-6.2.249/src/version.c Tue Feb 10 19:35:15 2004 | |
121 | --- src/version.c Tue Feb 10 19:36:41 2004 | |
122 | *************** | |
123 | *** 639,640 **** | |
124 | --- 639,642 ---- | |
125 | { /* Add new patch number below this line */ | |
126 | + /**/ | |
127 | + 250, | |
128 | /**/ | |
129 | ||
130 | -- | |
131 | I AM THANKFUL... | |
132 | ...for the mess to clean after a party because it means I have | |
133 | been surrounded by friends. | |
134 | ||
135 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
136 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
137 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
138 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |