| To: vim-dev@vim.org |
| Subject: Patch 7.2.126 |
| 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 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 |
| |
| |
| |
| |
| |
| *** 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 |
| |
| |
| |
| *** 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) |
| |
| |
| |
| *** 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)); |
| |
| |
| |
| *** 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 /// |