home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.2.250
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.2.250
- Problem: Memory leaks when using signs. (Xavier de Gaye)
- Solution: Delete the list of signs when unloading a buffer.
- Files: src/buffer.c
-
-
- *** ../vim-6.2.249/src/buffer.c Sun Jan 18 20:58:01 2004
- --- src/buffer.c Tue Feb 10 15:50:40 2004
- ***************
- *** 55,60 ****
- --- 55,65 ----
- # define dev_T unsigned
- #endif
-
- + #if defined(FEAT_SIGNS)
- + static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
- + static void buf_delete_signs __ARGS((buf_T *buf));
- + #endif
- +
- /*
- * Open current buffer, that is: open the memfile and read the file into memory
- * return FAIL for failure, OK otherwise
- ***************
- *** 559,564 ****
- --- 564,572 ----
- #ifdef FEAT_SYN_HL
- syntax_clear(buf); /* reset syntax info */
- #endif
- + #ifdef FEAT_SIGNS
- + buf_delete_signs(buf); /* delete any signs */
- + #endif
- }
-
- /*
- ***************
- *** 4557,4565 ****
-
-
- #if defined(FEAT_SIGNS) || defined(PROTO)
- -
- - static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
- -
- /*
- * Insert the sign into the signlist.
- */
- --- 4565,4570 ----
- ***************
- *** 4822,4845 ****
- # endif /* FEAT_NETBEANS_INTG */
-
-
- void
- buf_delete_all_signs()
- {
- buf_T *buf; /* buffer we are checking for signs */
- - signlist_T *sign; /* a sign in a b_signlist */
- - signlist_T *next; /* the next sign in a b_signlist */
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (buf->b_signlist != NULL)
- {
- /* Need to redraw the windows to remove the sign column. */
- redraw_buf_later(buf, NOT_VALID);
- ! for (sign = buf->b_signlist; sign != NULL; sign = next)
- ! {
- ! next = sign->next;
- ! vim_free(sign);
- ! }
- ! buf->b_signlist = NULL;
- }
- }
-
- --- 4827,4863 ----
- # endif /* FEAT_NETBEANS_INTG */
-
-
- + /*
- + * Delete signs in buffer "buf".
- + */
- + static void
- + buf_delete_signs(buf)
- + buf_T *buf;
- + {
- + signlist_T *next;
- +
- + while (buf->b_signlist != NULL)
- + {
- + next = buf->b_signlist->next;
- + vim_free(buf->b_signlist);
- + buf->b_signlist = next;
- + }
- + }
- +
- + /*
- + * Delete all signs in all buffers.
- + */
- void
- buf_delete_all_signs()
- {
- buf_T *buf; /* buffer we are checking for signs */
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (buf->b_signlist != NULL)
- {
- /* Need to redraw the windows to remove the sign column. */
- redraw_buf_later(buf, NOT_VALID);
- ! buf_delete_signs(buf);
- }
- }
-
- *** ../vim-6.2.249/src/version.c Tue Feb 10 19:35:15 2004
- --- src/version.c Tue Feb 10 19:36:41 2004
- ***************
- *** 639,640 ****
- --- 639,642 ----
- { /* Add new patch number below this line */
- + /**/
- + 250,
- /**/
-
- --
- I AM THANKFUL...
- ...for the mess to clean after a party because it means I have
- been surrounded by friends.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
- \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
- \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-