On Mon, May 12, 2008 at 3:01 PM, Dominique Pelle
<[EMAIL PROTECTED]> wrote:

> I observe a 100% reproducible internal error message
> "E685: Internal error: func_unref()" with vim-7.1.298 when:
>
> - building vim with -DEXITFREE
> - and using the NERD_tree.vim plugin
>
> It's a low priority bug since it only happens when building
> with -DEXITFREE (which is a debug feature normally
> disabled).
>
> Steps to reproduce:
>
> 1/ build vim with -DEXITFREE i.e. uncomment line
>   "PROFILE_CFLAGS = -DEXITFREE"
>   in vim7/src/Makefile
>
> 2/ install the NERD_tree.vim plugin available at:
>  http://www.vim.org/scripts/script.php?script_id=1658
>
> 3/ run...
>
>    $ vim -c NERDTree -c qa
>
> ... and observe that vim reports many internal errors when exiting:
>
> Error detected while processing command line:
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> E685: Internal error: func_unref()
> ...
> ... etc, error message repeats 10877 times
>
> I have not found a way fix yet.
>
> I'm using vim-7.1.298 on Linux x86.
>
> -- Dominique


I tried to debug it.  I found:

- one bug in delete_first_msg()  [message.c]:  when delete_first_msg()
  is called and the list of message becomes empty, last_msg_hist
  should be set to NULL.  Bug should only happen when Vim is
  compiled with -DEXITFREE since the list of message is never
  cleared otherwise.

- in eval_clear() [eval.c], free_all_functions() should be called I think
  (not 100% sure) after garbage_collect() because garbage_collect()
  uses hash of functions.  Again, this is only relevant if Vim is
  compiled with -DEXITFREE.

After those 2 fixes, I no longer see the internal error message as
described in the initial post.

Attached
- fix_delete_first_msg.message.c.patch
- fix_internal_error.eval.c.patch

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: message.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/message.c,v
retrieving revision 1.60
diff -c -r1.60 message.c
*** message.c	24 Nov 2007 14:44:34 -0000	1.60
--- message.c	17 May 2008 15:36:15 -0000
***************
*** 603,609 ****
  #endif
  
  	/*
! 	 * When using ":silent! cmd" ignore error messsages.
  	 * But do write it to the redirection file.
  	 */
  	if (emsg_silent != 0)
--- 603,609 ----
  #endif
  
  	/*
! 	 * When using ":silent! cmd" ignore error messages.
  	 * But do write it to the redirection file.
  	 */
  	if (emsg_silent != 0)
***************
*** 803,808 ****
--- 803,810 ----
  	return FAIL;
      p = first_msg_hist;
      first_msg_hist = p->next;
+     if (first_msg_hist == NULL)
+         last_msg_hist = NULL;
      vim_free(p->msg);
      vim_free(p);
      --msg_hist_len;
Index: eval.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/eval.c,v
retrieving revision 1.249
diff -c -r1.249 eval.c
*** eval.c	1 Apr 2008 11:12:09 -0000	1.249
--- eval.c	17 May 2008 15:36:51 -0000
***************
*** 817,831 ****
      /* global variables */
      vars_clear(&globvarht);
  
-     /* functions */
-     free_all_functions();
-     hash_clear(&func_hashtab);
- 
      /* autoloaded script names */
      ga_clear_strings(&ga_loaded);
  
      /* unreferenced lists and dicts */
      (void)garbage_collect();
  }
  #endif
  
--- 817,831 ----
      /* global variables */
      vars_clear(&globvarht);
  
      /* autoloaded script names */
      ga_clear_strings(&ga_loaded);
  
      /* unreferenced lists and dicts */
      (void)garbage_collect();
+ 
+     /* functions */
+     free_all_functions();
+     hash_clear(&func_hashtab);
  }
  #endif
  
***************
*** 4114,4120 ****
      }
  
      /*
!      * If there is a comparitive operator, use it.
       */
      if (type != TYPE_UNKNOWN)
      {
--- 4114,4120 ----
      }
  
      /*
!      * If there is a comparative operator, use it.
       */
      if (type != TYPE_UNKNOWN)
      {
***************
*** 4130,4136 ****
  	    ic = FALSE;
  	    ++len;
  	}
! 	/* nothing appened: use 'ignorecase' */
  	else
  	    ic = p_ic;
  
--- 4130,4136 ----
  	    ic = FALSE;
  	    ++len;
  	}
! 	/* nothing appended: use 'ignorecase' */
  	else
  	    ic = p_ic;
  
***************
*** 10585,10591 ****
  }
  
  /*
!  * Find window specifed by "vp" in tabpage "tp".
   */
      static win_T *
  find_win_by_nr(vp, tp)
--- 10585,10591 ----
  }
  
  /*
!  * Find window specified by "vp" in tabpage "tp".
   */
      static win_T *
  find_win_by_nr(vp, tp)
***************
*** 11798,11804 ****
      typval_T	*argvars;
      typval_T	*rettv;
  {
!     /* Add an entry to the stack of typehead storage. */
      if (ga_grow(&ga_userinput, 1) == OK)
      {
  	save_typeahead((tasave_T *)(ga_userinput.ga_data)
--- 11798,11804 ----
      typval_T	*argvars;
      typval_T	*rettv;
  {
!     /* Add an entry to the stack of typeahead storage. */
      if (ga_grow(&ga_userinput, 1) == OK)
      {
  	save_typeahead((tasave_T *)(ga_userinput.ga_data)
***************
*** 17607,17613 ****
  }
  
  /*
!  * Allocate memory for a variable type-value, and make it emtpy (0 or NULL
   * value).
   */
      static typval_T *
--- 17607,17613 ----
  }
  
  /*
!  * Allocate memory for a variable type-value, and make it empty (0 or NULL
   * value).
   */
      static typval_T *
***************
*** 20485,20491 ****
      did_emsg |= save_did_emsg;
      current_funccal = fc.caller;
  
!     /* The a: variables typevals were not alloced, only free the allocated
       * variables. */
      vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
  
--- 20485,20491 ----
      did_emsg |= save_did_emsg;
      current_funccal = fc.caller;
  
!     /* The a: variables typevals were not allocated, only free the allocated
       * variables. */
      vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
  
***************
*** 20819,20825 ****
  
  /*
   * Return TRUE if the currently active function should be ended, because a
!  * return was encountered or an error occured.  Used inside a ":while".
   */
      int
  func_has_ended(cookie)
--- 20819,20825 ----
  
  /*
   * Return TRUE if the currently active function should be ended, because a
!  * return was encountered or an error occurred.  Used inside a ":while".
   */
      int
  func_has_ended(cookie)
***************
*** 21190,21196 ****
      char_u	*pbuf, *tfname;
      int		hasTilde;
  
!     /* Count up the path seperators from the RHS.. so we know which part
       * of the path to return.
       */
      sepcount = 0;
--- 21190,21196 ----
      char_u	*pbuf, *tfname;
      int		hasTilde;
  
!     /* Count up the path separators from the RHS.. so we know which part
       * of the path to return.
       */
      sepcount = 0;

Raspunde prin e-mail lui