4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Memory leaks when using signs. (Xavier de Gaye)
12 Solution: Delete the list of signs when unloading a buffer.
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
21 # define dev_T unsigned
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));
30 * Open current buffer, that is: open the memfile and read the file into memory
31 * return FAIL for failure, OK otherwise
36 syntax_clear(buf); /* reset syntax info */
39 + buf_delete_signs(buf); /* delete any signs */
48 #if defined(FEAT_SIGNS) || defined(PROTO)
50 - static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
53 * Insert the sign into the signlist.
58 # endif /* FEAT_NETBEANS_INTG */
62 buf_delete_all_signs()
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 */
68 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
69 if (buf->b_signlist != NULL)
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)
78 ! buf->b_signlist = NULL;
83 # endif /* FEAT_NETBEANS_INTG */
87 + * Delete signs in buffer "buf".
90 + buf_delete_signs(buf)
95 + while (buf->b_signlist != NULL)
97 + next = buf->b_signlist->next;
98 + vim_free(buf->b_signlist);
99 + buf->b_signlist = next;
104 + * Delete all signs in all buffers.
107 buf_delete_all_signs()
109 buf_T *buf; /* buffer we are checking for signs */
111 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
112 if (buf->b_signlist != NULL)
114 /* Need to redraw the windows to remove the sign column. */
115 redraw_buf_later(buf, NOT_VALID);
116 ! buf_delete_signs(buf);
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
125 { /* Add new patch number below this line */
132 ...for the mess to clean after a party because it means I have
133 been surrounded by friends.
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 ///