To: vim-dev@vim.org Subject: Patch 7.2.126 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.2.126 Problem: When EXITFREE is defined signs are not freed. Solution: Free all signs on exit. Also free keymaps. (Dominique Pelle) Files: src/misc2.c, src/ex_cmds.c, src/proto/ex_cmds.pro *** ../vim-7.2.125/src/misc2.c Thu Jan 22 21:31:24 2009 --- src/misc2.c Sun Feb 22 22:04:53 2009 *************** *** 1010,1015 **** --- 1010,1018 ---- # if defined(FEAT_PROFILE) do_cmdline_cmd((char_u *)"profdel *"); # endif + # if defined(FEAT_KEYMAP) + do_cmdline_cmd((char_u *)"set keymap="); + #endif # ifdef FEAT_TITLE free_titles(); *************** *** 1034,1039 **** --- 1037,1045 ---- free_regexp_stuff(); free_tag_stuff(); free_cd_dir(); + # ifdef FEAT_SIGNS + free_signs(); + # endif # ifdef FEAT_EVAL set_expr_line(NULL); # endif *** ../vim-7.2.125/src/ex_cmds.c Wed Feb 11 16:02:29 2009 --- src/ex_cmds.c Sun Feb 22 22:07:08 2009 *************** *** 6541,6546 **** --- 6541,6547 ---- static int last_sign_typenr = MAX_TYPENR; /* is decremented */ static void sign_list_defined __ARGS((sign_T *sp)); + static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev)); /* * ":sign" command *************** *** 6749,6772 **** /* ":sign list {name}" */ sign_list_defined(sp); else - { /* ":sign undefine {name}" */ ! vim_free(sp->sn_name); ! vim_free(sp->sn_icon); ! #ifdef FEAT_SIGN_ICONS ! if (sp->sn_image != NULL) ! { ! out_flush(); ! gui_mch_destroy_sign(sp->sn_image); ! } ! #endif ! vim_free(sp->sn_text); ! if (sp_prev == NULL) ! first_sign = sp->sn_next; ! else ! sp_prev->sn_next = sp->sn_next; ! vim_free(sp); ! } } } else --- 6750,6757 ---- /* ":sign list {name}" */ sign_list_defined(sp); else /* ":sign undefine {name}" */ ! sign_undefine(sp, sp_prev); } } else *************** *** 7015,7020 **** --- 7000,7030 ---- } /* + * Undefine a sign and free its memory. + */ + static void + sign_undefine(sp, sp_prev) + sign_T *sp; + sign_T *sp_prev; + { + vim_free(sp->sn_name); + vim_free(sp->sn_icon); + #ifdef FEAT_SIGN_ICONS + if (sp->sn_image != NULL) + { + out_flush(); + gui_mch_destroy_sign(sp->sn_image); + } + #endif + vim_free(sp->sn_text); + if (sp_prev == NULL) + first_sign = sp->sn_next; + else + sp_prev->sn_next = sp->sn_next; + vim_free(sp); + } + + /* * Get highlighting attribute for sign "typenr". * If "line" is TRUE: line highl, if FALSE: text highl. */ *************** *** 7088,7093 **** --- 7098,7115 ---- return (char_u *)_("[Deleted]"); } + #if defined(EXITFREE) || defined(PROTO) + /* + * Undefine/free all signs. + */ + void + free_signs() + { + while (first_sign != NULL) + sign_undefine(first_sign, NULL); + } + #endif + #endif #if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) *** ../vim-7.2.125/src/proto/ex_cmds.pro Sat Nov 15 14:10:23 2008 --- src/proto/ex_cmds.pro Sun Feb 22 22:04:53 2009 *************** *** 40,45 **** --- 40,46 ---- int read_viminfo_sub_string __ARGS((vir_T *virp, int force)); void write_viminfo_sub_string __ARGS((FILE *fp)); void free_old_sub __ARGS((void)); + void free_signs __ARGS((void)); int prepare_tagpreview __ARGS((int undo_sync)); void ex_help __ARGS((exarg_T *eap)); char_u *check_help_lang __ARGS((char_u *arg)); *** ../vim-7.2.125/src/version.c Tue Feb 24 04:11:07 2009 --- src/version.c Tue Feb 24 04:24:46 2009 *************** *** 678,679 **** --- 678,681 ---- { /* Add new patch number below this line */ + /**/ + 126, /**/ -- hundred-and-one symptoms of being an internet addict: 125. You begin to wonder how often it REALLY is necessary to get up and shower or bathe. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///