Loading ...
Sorry, an error occurred while loading the content.

%! item in 'statusline' option causes an error.

Expand Messages
  • Yukihiro Nakadaira
    When using %! item in statusline option, Vim sometimes shows an error and sometimes crash. vimrc.vim: set statusline=%!MyStatusLine() set laststatus=2
    Message 1 of 6 , Nov 2, 2009
    • 0 Attachment
      When using %! item in 'statusline' option, Vim sometimes shows an error
      and sometimes crash.

      vimrc.vim:
      set statusline=%!MyStatusLine()
      set laststatus=2
      function MyStatusLine()
      return ""
      endfunction

      $ gvim -u vimrc.vim
      Error detected while processing function MyStatusLine:
      E121: Undefined variable: MyStatusLine
      Error detected while processing function MyStatusLine:
      E15: Invalid expression: MyStatusLine
      E15: Invalid expression: ~W^Iá3~L (message is random text)

      I am using GTK2 GUI. I saw the error at startup and when using
      scrollbar.

      The error can be reproduced by using :redraw! command in MyStatusLine().

      function MyStatusLine()
      redraw!
      return ""
      endfunction


      It seems that:

      1. build_stl_str_hl()
      w_p_stl is "%!MyStatusLine()".

      2. eval_to_string()
      Evaluate "MyStatusLine()".

      3. call_func()
      8021 cc = name[len];
      8022 name[len] = NUL;
      At this time, name == w_p_stl + 2.
      Then w_p_stl is changed from "%!MyStatusLine()" to "%!MyStatusLine"

      4. call_user_func()
      In this function, line_breakcheck() is invoked. Then Vim processes
      the GUI event loop. If there is an event which is cause of drawing,
      Vim draws statusline again.

      5. build_stl_str_hl()
      At this time, w_p_stl is "%!MyStatusLine" by 3. call_func().

      6. eval_to_string()
      Evaluate "MyStatusLine"

      7. get_var_tv()
      Echo error "E121: Undefined variable: MyStatusLine"

      8. eval0()
      Echo error "E15: Invalid expression: MyStatusLine"

      9. redraw_custum_statusline()
      5907 if (called_emsg)
      5908 set_string_option_direct((char_u *)"statusline", -1,
      5909 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
      5910 ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
      Since error is raised, w_p_stl is freed.

      (back to first statusline drawing)

      10. eval0()
      3924 if (!aborting())
      3925 EMSG2(_(e_invexpr2), arg);
      Echo error "E15: Invalid expression: ~W^Iá3~L"
      At this time, arg == w_p_stl + 2.
      And w_p_stl is already freed.


      The following is an backtrace at 7.

      Breakpoint 1, get_var_tv (name=0x8216f02 "MyStatusLine", len=12,
      rettv=0xbfff961c, verbose=1) at eval.c:18349
      18349 EMSG2(_(e_undefvar), name);
      (gdb) bt
      #0 get_var_tv (name=0x8216f02 "MyStatusLine", len=12, rettv=0xbfff961c,
      verbose=1) at eval.c:18349
      #1 0x08076a9b in eval7 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1,
      want_string=0) at eval.c:5027
      #2 0x08076367 in eval6 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1,
      want_string=0) at eval.c:4680
      #3 0x08075f5d in eval5 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1)
      at eval.c:4496
      #4 0x08075507 in eval4 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1)
      at eval.c:4191
      #5 0x08075375 in eval3 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1)
      at eval.c:4103
      #6 0x08075217 in eval2 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1)
      at eval.c:4032
      #7 0x08075068 in eval1 (arg=0xbfff95b8, rettv=0xbfff961c, evaluate=1)
      at eval.c:3957
      #8 0x08074fd3 in eval0 (arg=0x8216f02 "MyStatusLine", rettv=0xbfff961c,
      nextcmd=0x0, evaluate=1) at eval.c:3914
      #9 0x08070e15 in eval_to_string (arg=0x8216f02 "MyStatusLine", nextcmd=0x0,
      convert=0) at eval.c:1296
      #10 0x08070f5a in eval_to_string_safe (arg=0x8216f02 "MyStatusLine",
      nextcmd=0x0, use_sandbox=0) at eval.c:1340
      #11 0x080577df in build_stl_str_hl (wp=0x8216fc8, out=0xbfffa36c "\364\257U",
      outlen=4096, fmt=0x8216f00 "%!MyStatusLine", use_sandbox=0, fillchar=32,
      maxwidth=81, hltab=0xbfffa0c0, tabtab=0xbfff9e40) at buffer.c:3415
      #12 0x0815a857 in win_redr_custom (wp=0x8216fc8, draw_ruler=0) at screen.c:6101
      #13 0x0815a367 in redraw_custum_statusline (wp=0x8216fc8) at screen.c:5906
      #14 0x08159ebb in win_redr_status (wp=0x8216fc8) at screen.c:5775
      #15 0x081515b5 in update_screen (type=40) at screen.c:529
      #16 0x0819d68e in set_shellsize (width=0, height=0, mustset=0) at term.c:3161
      #17 0x0819d4c6 in shell_resized () at term.c:3040
      #18 0x081b19d3 in gui_resize_shell (pixel_width=587, pixel_height=663)
      at gui.c:1318
      #19 0x081bf86a in form_configure_event (widget=0x833b808, event=0xbfffb8c0,
      data=0x0) at gui_gtk_x11.c:4002
      #20 0x00bee474 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #21 0x00269072 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
      #22 0x0027e7a8 in ?? () from /usr/lib/libgobject-2.0.so.0
      #23 0x0027f9b8 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
      #24 0x0027ffb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
      #25 0x00d0a96e in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #26 0x00be807c in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
      #27 0x081c4b26 in gtk_form_send_configure (form=0x833b808) at gui_gtk_f.c:905
      #28 0x081c4052 in gtk_form_size_allocate (widget=0x833b808,
      allocation=0xbfffbcb0) at gui_gtk_f.c:519
      #29 0x00276068 in g_cclosure_marshal_VOID__BOXED ()
      from /usr/lib/libgobject-2.0.so.0
      #30 0x002676f9 in ?? () from /usr/lib/libgobject-2.0.so.0
      #31 0x00268f98 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
      #32 0x0027e0b0 in ?? () from /usr/lib/libgobject-2.0.so.0
      #33 0x0027fb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
      #34 0x0027ffb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
      #35 0x00d125f0 in gtk_widget_size_allocate () from /usr/lib/libgtk-x11-2.0.so.0
      #36 0x00b26c7f in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #37 0x00276068 in g_cclosure_marshal_VOID__BOXED ()
      from /usr/lib/libgobject-2.0.so.0
      #38 0x002676f9 in ?? () from /usr/lib/libgobject-2.0.so.0
      #39 0x00268f98 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
      #40 0x0027e0b0 in ?? () from /usr/lib/libgobject-2.0.so.0
      #41 0x0027fb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
      #42 0x0027ffb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
      #43 0x00d125f0 in gtk_widget_size_allocate () from /usr/lib/libgtk-x11-2.0.so.0
      #44 0x00d24deb in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #45 0x00276068 in g_cclosure_marshal_VOID__BOXED ()
      from /usr/lib/libgobject-2.0.so.0
      #46 0x002676f9 in ?? () from /usr/lib/libgobject-2.0.so.0
      #47 0x00269072 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
      #48 0x0027e0b0 in ?? () from /usr/lib/libgobject-2.0.so.0
      #49 0x0027fb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
      #50 0x0027ffb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
      #51 0x00d125f0 in gtk_widget_size_allocate () from /usr/lib/libgtk-x11-2.0.so.0
      #52 0x00d25260 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #53 0x002769fc in g_cclosure_marshal_VOID__VOID ()
      from /usr/lib/libgobject-2.0.so.0
      #54 0x002676f9 in ?? () from /usr/lib/libgobject-2.0.so.0
      #55 0x00269072 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
      #56 0x0027e49e in ?? () from /usr/lib/libgobject-2.0.so.0
      #57 0x0027fb2d in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
      #58 0x0027ffb6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
      #59 0x00b5a31a in gtk_container_check_resize ()
      from /usr/lib/libgtk-x11-2.0.so.0
      #60 0x00b5a370 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
      #61 0x00125f78 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
      #62 0x002d30f1 in ?? () from /lib/libglib-2.0.so.0
      #63 0x002d4e78 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
      #64 0x002d8720 in ?? () from /lib/libglib-2.0.so.0
      #65 0x002d8853 in g_main_context_iteration () from /lib/libglib-2.0.so.0
      #66 0x00be8203 in gtk_main_iteration_do () from /usr/lib/libgtk-x11-2.0.so.0
      #67 0x081c217c in gui_mch_update () at gui_gtk_x11.c:6473
      #68 0x081a0b4f in ui_breakcheck () at ui.c:364
      #69 0x08103dc7 in line_breakcheck () at misc1.c:8423
      #70 0x0808d2a1 in call_user_func (fp=0x82881a8, argcount=0, argvars=0xbfffcee8,
      rettv=0xbfffd40c, firstline=1, lastline=1, selfdict=0x0) at eval.c:21096
      #71 0x0807a81d in call_func (name=0x8216f02 "MyStatusLine", len=12,
      rettv=0xbfffd40c, argcount=0, argvars=0xbfffcee8, firstline=1, lastline=1,
      doesrange=0xbfffd078, evaluate=1, selfdict=0x0) at eval.c:8115
      #72 0x0807a471 in get_func_tv (name=0x8216f02 "MyStatusLine", len=12,
      rettv=0xbfffd40c, arg=0xbfffd3a8, firstline=1, lastline=1,
      doesrange=0xbfffd078, evaluate=1, selfdict=0x0) at eval.c:7961
      #73 0x08076a4e in eval7 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1,
      want_string=0) at eval.c:5013
      #74 0x08076367 in eval6 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1,
      want_string=0) at eval.c:4680
      #75 0x08075f5d in eval5 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1)
      at eval.c:4496
      #76 0x08075507 in eval4 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1)
      at eval.c:4191
      #77 0x08075375 in eval3 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1)
      at eval.c:4103
      #78 0x08075217 in eval2 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1)
      at eval.c:4032
      #79 0x08075068 in eval1 (arg=0xbfffd3a8, rettv=0xbfffd40c, evaluate=1)
      at eval.c:3957
      #80 0x08074fd3 in eval0 (arg=0x8216f02 "MyStatusLine", rettv=0xbfffd40c,
      nextcmd=0x0, evaluate=1) at eval.c:3914
      #81 0x08070e15 in eval_to_string (arg=0x8216f02 "MyStatusLine", nextcmd=0x0,
      convert=0) at eval.c:1296
      #82 0x08070f5a in eval_to_string_safe (arg=0x8216f02 "MyStatusLine",
      nextcmd=0x0, use_sandbox=0) at eval.c:1340
      #83 0x080577df in build_stl_str_hl (wp=0x8216fc8,
      out=0xbfffe15c "?P\a\b\034aH\b\360\341\377\277\003", outlen=4096,
      fmt=0x8216f00 "%!MyStatusLine", use_sandbox=0, fillchar=32, maxwidth=81,
      hltab=0xbfffdeb0, tabtab=0xbfffdc30) at buffer.c:3415
      #84 0x0815a857 in win_redr_custom (wp=0x8216fc8, draw_ruler=0) at screen.c:6101
      #85 0x0815a367 in redraw_custum_statusline (wp=0x8216fc8) at screen.c:5906
      #86 0x0815f96b in showruler (always=0) at screen.c:9468
      #87 0x080dd6b2 in main_loop (cmdwin=0, noexmode=0) at main.c:1147
      #88 0x080dd281 in main (argc=3, argv=0xbffff434) at main.c:942


      --
      Yukihiro Nakadaira - yukihiro.nakadaira@...

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Dominique Pellé
      ... Hi I can reproduce the crash too with the redraw! inside the MyStatusLine() function as you describe. The attached patch fixes it for me but please verify
      Message 2 of 6 , Nov 2, 2009
      • 0 Attachment
        Yukihiro Nakadaira wrote:

        > When using %! item in 'statusline' option, Vim sometimes shows an error
        > and sometimes crash.
        >
        >   vimrc.vim:
        >     set statusline=%!MyStatusLine()
        >     set laststatus=2
        >     function MyStatusLine()
        >       return ""
        >     endfunction
        >
        >   $ gvim -u vimrc.vim
        >   Error detected while processing function MyStatusLine:
        >   E121: Undefined variable: MyStatusLine
        >   Error detected while processing function MyStatusLine:
        >   E15: Invalid expression: MyStatusLine
        >   E15: Invalid expression: ~W^Iá3~L          (message is random text)
        >
        > I am using GTK2 GUI.  I saw the error at startup and when using
        > scrollbar.
        >
        > The error can be reproduced by using :redraw! command in MyStatusLine().
        >
        >     function MyStatusLine()
        >       redraw!
        >       return ""
        >     endfunction

        Hi

        I can reproduce the crash too with the redraw! inside the
        MyStatusLine() function as you describe.

        The attached patch fixes it for me but please verify it and review it.
        Patch prevents recursive call of redraw_custum_statusline().

        Regards
        -- Dominique

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Bram Moolenaar
        ... I can t reproduce it right away, but your explanation shows what is wrong. I ll add it to the todo list. -- ARTHUR: But if he was dying, he
        Message 3 of 6 , Nov 2, 2009
        • 0 Attachment
          Yukihiro Nakadaira wrote:

          > When using %! item in 'statusline' option, Vim sometimes shows an error
          > and sometimes crash.
          >
          > vimrc.vim:
          > set statusline=%!MyStatusLine()
          > set laststatus=2
          > function MyStatusLine()
          > return ""
          > endfunction
          >
          > $ gvim -u vimrc.vim
          > Error detected while processing function MyStatusLine:
          > E121: Undefined variable: MyStatusLine
          > Error detected while processing function MyStatusLine:
          > E15: Invalid expression: MyStatusLine
          > E15: Invalid expression: ~W^Iá3~L (message is random text)
          >
          > I am using GTK2 GUI. I saw the error at startup and when using
          > scrollbar.
          >
          > The error can be reproduced by using :redraw! command in MyStatusLine().
          >
          > function MyStatusLine()
          > redraw!
          > return ""
          > endfunction
          >
          >
          > It seems that:
          >
          > 1. build_stl_str_hl()
          > w_p_stl is "%!MyStatusLine()".
          >
          > 2. eval_to_string()
          > Evaluate "MyStatusLine()".
          >
          > 3. call_func()
          > 8021 cc = name[len];
          > 8022 name[len] = NUL;
          > At this time, name == w_p_stl + 2.
          > Then w_p_stl is changed from "%!MyStatusLine()" to "%!MyStatusLine"
          >
          > 4. call_user_func()
          > In this function, line_breakcheck() is invoked. Then Vim processes
          > the GUI event loop. If there is an event which is cause of drawing,
          > Vim draws statusline again.
          >
          > 5. build_stl_str_hl()
          > At this time, w_p_stl is "%!MyStatusLine" by 3. call_func().
          >
          > 6. eval_to_string()
          > Evaluate "MyStatusLine"
          >
          > 7. get_var_tv()
          > Echo error "E121: Undefined variable: MyStatusLine"
          >
          > 8. eval0()
          > Echo error "E15: Invalid expression: MyStatusLine"
          >
          > 9. redraw_custum_statusline()
          > 5907 if (called_emsg)
          > 5908 set_string_option_direct((char_u *)"statusline", -1,
          > 5909 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
          > 5910 ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
          > Since error is raised, w_p_stl is freed.
          >
          > (back to first statusline drawing)
          >
          > 10. eval0()
          > 3924 if (!aborting())
          > 3925 EMSG2(_(e_invexpr2), arg);
          > Echo error "E15: Invalid expression: ~W^Iá3~L"
          > At this time, arg == w_p_stl + 2.
          > And w_p_stl is already freed.

          I can't reproduce it right away, but your explanation shows what is
          wrong. I'll add it to the todo list.

          --
          ARTHUR: But if he was dying, he wouldn't bother to carve
          "Aaaaarrrrrrggghhh". He'd just say it.
          BROTHER MAYNARD: It's down there carved in stone.
          GALAHAD: Perhaps he was dictating.
          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

          /// Bram Moolenaar -- Bram@... -- 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 ///

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Dominique Pellé
          ... If that helps to understand the problem and to reproduce it, this is what Valgrind shows when doing... $ cd vim7/src $ cat vimrc.vim set
          Message 4 of 6 , Nov 2, 2009
          • 0 Attachment
            Bram Moolenaar wrote:

            > Yukihiro Nakadaira wrote:
            >
            >> When using %! item in 'statusline' option, Vim sometimes shows an error
            >> and sometimes crash.
            >>
            >>    vimrc.vim:
            >>      set statusline=%!MyStatusLine()
            >>      set laststatus=2
            >>      function MyStatusLine()
            >>        return ""
            >>      endfunction
            >>
            >>    $ gvim -u vimrc.vim
            >>    Error detected while processing function MyStatusLine:
            >>    E121: Undefined variable: MyStatusLine
            >>    Error detected while processing function MyStatusLine:
            >>    E15: Invalid expression: MyStatusLine
            >>    E15: Invalid expression: ~W^Iá3~L          (message is random text)
            >>
            >> I am using GTK2 GUI.  I saw the error at startup and when using
            >> scrollbar.
            >>
            >> The error can be reproduced by using :redraw! command in MyStatusLine().
            >>
            >>      function MyStatusLine()
            >>        redraw!
            >>        return ""
            >>      endfunction
            >>
            >>
            >> It seems that:
            >>
            >>    1. build_stl_str_hl()
            >>      w_p_stl is "%!MyStatusLine()".
            >>
            >>    2. eval_to_string()
            >>      Evaluate "MyStatusLine()".
            >>
            >>    3. call_func()
            >>      8021     cc = name[len];
            >>      8022     name[len] = NUL;
            >>      At this time, name == w_p_stl + 2.
            >>      Then w_p_stl is changed from "%!MyStatusLine()" to "%!MyStatusLine"
            >>
            >>    4. call_user_func()
            >>      In this function, line_breakcheck() is invoked.  Then Vim processes
            >>      the GUI event loop.  If there is an event which is cause of drawing,
            >>      Vim draws statusline again.
            >>
            >>      5. build_stl_str_hl()
            >>        At this time, w_p_stl is "%!MyStatusLine" by 3. call_func().
            >>
            >>      6. eval_to_string()
            >>        Evaluate "MyStatusLine"
            >>
            >>      7. get_var_tv()
            >>        Echo error "E121: Undefined variable: MyStatusLine"
            >>
            >>      8. eval0()
            >>        Echo error "E15: Invalid expression: MyStatusLine"
            >>
            >>      9. redraw_custum_statusline()
            >>        5907     if (called_emsg)
            >>        5908         set_string_option_direct((char_u *)"statusline", -1,
            >>        5909                 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
            >>        5910                                         ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
            >>        Since error is raised, w_p_stl is freed.
            >>
            >>      (back to first statusline drawing)
            >>
            >>    10. eval0()
            >>      3924         if (!aborting())
            >>      3925             EMSG2(_(e_invexpr2), arg);
            >>      Echo error "E15: Invalid expression: ~W^Iá3~L"
            >>      At this time, arg == w_p_stl + 2.
            >>      And w_p_stl is already freed.
            >
            > I can't reproduce it right away, but your explanation shows what is
            > wrong.  I'll add it to the todo list.


            If that helps to understand the problem and to reproduce it,
            this is what Valgrind shows when doing...

            $ cd vim7/src
            $ cat vimrc.vim
            set statusline=%!MyStatusLine()
            set laststatus=2
            function MyStatusLine()
            redraw!
            return ""
            endfunction

            $ valgrind ./vim -u NONE -c ':so vimrc.vim' 2> vg.log

            ==7246== Invalid write of size 1
            ==7246== at 0x807CF67: call_func (eval.c:8193)
            ==7246== by 0x807C9FE: get_func_tv (eval.c:7961)
            ==7246== by 0x8078D96: eval7 (eval.c:5013)
            ==7246== by 0x807869F: eval6 (eval.c:4680)
            ==7246== by 0x807828B: eval5 (eval.c:4496)
            ==7246== by 0x80777DC: eval4 (eval.c:4191)
            ==7246== by 0x8077634: eval3 (eval.c:4103)
            ==7246== by 0x80774C0: eval2 (eval.c:4032)
            ==7246== by 0x80772F0: eval1 (eval.c:3957)
            ==7246== by 0x8077257: eval0 (eval.c:3914)
            ==7246== by 0x8072E5C: eval_to_string (eval.c:1296)
            ==7246== by 0x8072FA1: eval_to_string_safe (eval.c:1340)
            ==7246== by 0x8058240: build_stl_str_hl (buffer.c:3415)
            ==7246== by 0x816DFFC: win_redr_custom (screen.c:6101)
            ==7246== by 0x816DAB4: redraw_custum_statusline (screen.c:5906)
            ==7246== by 0x8173480: showruler (screen.c:9468)
            ==7246== by 0x80E7AC8: main_loop (main.c:1147)
            ==7246== by 0x80E769A: main (main.c:942)
            ==7246== Address 0x54c12f2 is 18 bytes inside a block of size 21 free'd
            ==7246== at 0x4024E5A: free (vg_replace_malloc.c:323)
            ==7246== by 0x81160E0: vim_free (misc2.c:1642)
            ==7246== by 0x8140852: free_string_option (option.c:5207)
            ==7246== by 0x8140B5F: set_string_option_direct (option.c:5360)
            ==7246== by 0x816DB0A: redraw_custum_statusline (screen.c:5908)
            ==7246== by 0x816D60A: win_redr_status (screen.c:5775)
            ==7246== by 0x8164051: update_screen (screen.c:529)
            ==7246== by 0x80B0681: ex_redraw (ex_docmd.c:8600)
            ==7246== by 0x80A7494: do_one_cmd (ex_docmd.c:2629)
            ==7246== by 0x80A4CCB: do_cmdline (ex_docmd.c:1098)
            ==7246== by 0x8090C5B: call_user_func (eval.c:21284)
            ==7246== by 0x807CDBA: call_func (eval.c:8115)
            ==7246== by 0x807C9FE: get_func_tv (eval.c:7961)
            ==7246== by 0x8078D96: eval7 (eval.c:5013)
            ==7246== by 0x807869F: eval6 (eval.c:4680)
            ==7246== by 0x807828B: eval5 (eval.c:4496)
            ==7246== by 0x80777DC: eval4 (eval.c:4191)
            ==7246== by 0x8077634: eval3 (eval.c:4103)
            ==7246== by 0x80774C0: eval2 (eval.c:4032)
            ==7246== by 0x80772F0: eval1 (eval.c:3957)
            ==7246== by 0x8077257: eval0 (eval.c:3914)
            ==7246== by 0x8072E5C: eval_to_string (eval.c:1296)
            ==7246== by 0x8072FA1: eval_to_string_safe (eval.c:1340)
            ==7246== by 0x8058240: build_stl_str_hl (buffer.c:3415)
            ==7246== by 0x816DFFC: win_redr_custom (screen.c:6101)
            ==7246== by 0x816DAB4: redraw_custum_statusline (screen.c:5906)
            ==7246== by 0x8173480: showruler (screen.c:9468)
            ==7246== by 0x80E7AC8: main_loop (main.c:1147)
            ==7246== by 0x80E769A: main (main.c:942)
            (and more errors after that)

            Notice that in the stack, function redraw_custom_statusline()
            is called recursively (patch in my previous message fixed it).

            Cheers
            -- Dominique

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Yukihiro Nakadaira
            ... Thank you. I cannot see error with your patch. Although this is minor problem, I got double statusline like the following. ... +-------------------------+
            Message 5 of 6 , Nov 3, 2009
            • 0 Attachment
              Dominique Pellé wrote:
              > I can reproduce the crash too with the redraw! inside the
              > MyStatusLine() function as you describe.
              >
              > The attached patch fixes it for me but please verify it and review it.
              > Patch prevents recursive call of redraw_custum_statusline().

              Thank you. I cannot see error with your patch.

              Although this is minor problem, I got double statusline like the
              following.

              |~ |
              |~ |
              |[No Name] ... |
              |[No Name] ... |
              +-------------------------+

              After CTRL-L, statusline is displayed normally.


              --
              Yukihiro Nakadaira - yukihiro.nakadaira@...


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Yukihiro Nakadaira
              ... Actually this script cannot reproduce an error. More lines are required. set statusline=%!MyStatusLine() set laststatus=2 function MyStatusLine() return
              Message 6 of 6 , Nov 3, 2009
              • 0 Attachment
                > set statusline=%!MyStatusLine()
                > set laststatus=2
                > function MyStatusLine()
                > return ""
                > endfunction

                Actually this script cannot reproduce an error. More lines are
                required.

                set statusline=%!MyStatusLine()
                set laststatus=2
                function MyStatusLine()
                return ""
                endfunction

                " count up breakcheck_count of misc1.c
                call substitute('x', 'x', 'x', '')
                call substitute('x', 'x', 'x', '')
                call substitute('x', 'x', 'x', '')
                ...
                ... depends on compiler flag or locale or something.

                And when this line is executed
                main.c:main_loop()
                1147 showruler(FALSE);
                breakcheck_count must be "breakcheck_count >= BREAKCHECK_SKIP - 1".

                And run vim many times.

                for i in 1 2 3 4 5 6 7 8 9 10; do
                ./vim -u NONE -S vimrc.vim -g
                done

                One of them might show an error.


                --
                Yukihiro Nakadaira - yukihiro.nakadaira@...



                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              Your message has been successfully submitted and would be delivered to recipients shortly.