summaryrefslogtreecommitdiffstats
path: root/vi/vim-7.2/7.2.126
blob: fe2dd6576c98bf07056232874435024ef22868c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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


*** ../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    ///