mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:7.4.1868
Problem:    Setting really_exiting causes memory leaks to be reported.
Solution:   Add the in_free_all_mem flag.
b89a25f17e
			
			
This commit is contained in:
		| @@ -21569,10 +21569,10 @@ void func_unref(char_u *name) | |||||||
|   if (name != NULL && isdigit(*name)) { |   if (name != NULL && isdigit(*name)) { | ||||||
|     fp = find_func(name); |     fp = find_func(name); | ||||||
|     if (fp == NULL) { |     if (fp == NULL) { | ||||||
|       // Ignore when invoked through free_all_mem(). | #ifdef EXITFREE | ||||||
|       if (!really_exiting) { |       if (!entered_free_all_mem) | ||||||
|  | #endif | ||||||
|         EMSG2(_(e_intern2), "func_unref()"); |         EMSG2(_(e_intern2), "func_unref()"); | ||||||
|       } |  | ||||||
|     } else { |     } else { | ||||||
|       user_func_unref(fp); |       user_func_unref(fp); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -636,6 +636,10 @@ EXTERN int exiting INIT(= FALSE); | |||||||
| /* TRUE when planning to exit Vim.  Might | /* TRUE when planning to exit Vim.  Might | ||||||
|  * still keep on running if there is a changed |  * still keep on running if there is a changed | ||||||
|  * buffer. */ |  * buffer. */ | ||||||
|  | #if defined(EXITFREE) | ||||||
|  | // true when in or after free_all_mem() | ||||||
|  | EXTERN bool entered_free_all_mem INIT(= false); | ||||||
|  | #endif | ||||||
| /* volatile because it is used in signal handler deathtrap(). */ | /* volatile because it is used in signal handler deathtrap(). */ | ||||||
| EXTERN volatile int full_screen INIT(= FALSE); | EXTERN volatile int full_screen INIT(= FALSE); | ||||||
| /* TRUE when doing full-screen output | /* TRUE when doing full-screen output | ||||||
|   | |||||||
| @@ -488,16 +488,12 @@ void time_to_bytes(time_t time_, uint8_t buf[8]) | |||||||
| void free_all_mem(void) | void free_all_mem(void) | ||||||
| { | { | ||||||
|   buf_T       *buf, *nextbuf; |   buf_T       *buf, *nextbuf; | ||||||
|   static bool entered = false; |  | ||||||
|  |  | ||||||
|   /* When we cause a crash here it is caught and Vim tries to exit cleanly. |   /* When we cause a crash here it is caught and Vim tries to exit cleanly. | ||||||
|    * Don't try freeing everything again. */ |    * Don't try freeing everything again. */ | ||||||
|   if (entered) |   if (entered_free_all_mem) | ||||||
|     return; |     return; | ||||||
|   entered = true; |   entered_free_all_mem = true; | ||||||
|  |  | ||||||
|   // Set this flag to indicate some errors can be ignored. |  | ||||||
|   really_exiting = true; |  | ||||||
|  |  | ||||||
|   // Don't want to trigger autocommands from here on. |   // Don't want to trigger autocommands from here on. | ||||||
|   block_autocmds(); |   block_autocmds(); | ||||||
|   | |||||||
| @@ -572,7 +572,7 @@ static int included_patches[] = { | |||||||
|   1871, |   1871, | ||||||
|   // 1870 NA |   // 1870 NA | ||||||
|   // 1869 NA |   // 1869 NA | ||||||
|   // 1868, |   1868, | ||||||
|   1867, |   1867, | ||||||
|   1866, |   1866, | ||||||
|   // 1865 NA |   // 1865 NA | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 James McCoy
					James McCoy