home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.822 < prev    next >
Encoding:
Internet Message Format  |  2013-02-16  |  3.9 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.822
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.822 (after 7.3.799)
  11. Problem:    Crash when accessing freed buffer.
  12. Solution:   Get 'textwidth' in caller of enter_buffer(). (Christian Brabandt)
  13. Files:        src/buffer.c
  14.  
  15.  
  16. *** ../vim-7.3.821/src/buffer.c    2013-02-06 18:44:57.000000000 +0100
  17. --- src/buffer.c    2013-02-17 15:10:44.000000000 +0100
  18. ***************
  19. *** 82,87 ****
  20. --- 82,90 ----
  21.   #ifdef FEAT_AUTOCMD
  22.       buf_T    *old_curbuf;
  23.   #endif
  24. + #ifdef FEAT_SYN_HL
  25. +     long    old_tw = curbuf->b_p_tw;
  26. + #endif
  27.   
  28.       /*
  29.        * The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
  30. ***************
  31. *** 113,118 ****
  32. --- 116,125 ----
  33.       }
  34.       EMSG(_("E83: Cannot allocate buffer, using other one..."));
  35.       enter_buffer(curbuf);
  36. + #ifdef FEAT_SYN_HL
  37. +     if (old_tw != curbuf->b_p_tw)
  38. +         check_colorcolumn(curwin);
  39. + #endif
  40.       return FAIL;
  41.       }
  42.   
  43. ***************
  44. *** 786,791 ****
  45. --- 793,801 ----
  46.   # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
  47.       cleanup_T    cs;
  48.   # endif
  49. + #ifdef FEAT_SYN_HL
  50. +     long    old_tw = curbuf->b_p_tw;
  51. + #endif
  52.   
  53.       if (swap_exists_action == SEA_QUIT)
  54.       {
  55. ***************
  56. *** 804,810 ****
  57. --- 814,826 ----
  58.       if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
  59.           old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
  60.       if (old_curbuf != NULL)
  61. +     {
  62.           enter_buffer(old_curbuf);
  63. + #ifdef FEAT_SYN_HL
  64. +         if (old_tw != curbuf->b_p_tw)
  65. +         check_colorcolumn(curwin);
  66. + #endif
  67. +     }
  68.       /* If "old_curbuf" is NULL we are in big trouble here... */
  69.   
  70.   # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
  71. ***************
  72. *** 1364,1369 ****
  73. --- 1380,1388 ----
  74.       buf_T    *prevbuf;
  75.       int        unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
  76.                                || action == DOBUF_WIPE);
  77. + #ifdef FEAT_SYN_HL
  78. +     long    old_tw = curbuf->b_p_tw;
  79. + #endif
  80.   
  81.       setpcmark();
  82.       if (!cmdmod.keepalt)
  83. ***************
  84. *** 1430,1450 ****
  85.   # endif
  86.          )
  87.   #endif
  88.       enter_buffer(buf);
  89.   }
  90.   
  91.   /*
  92.    * Enter a new current buffer.
  93. !  * Old curbuf must have been abandoned already!
  94.    */
  95.       void
  96.   enter_buffer(buf)
  97.       buf_T    *buf;
  98.   {
  99. - #ifdef FEAT_SYN_HL
  100. -     long old_tw = curbuf->b_p_tw;
  101. - #endif
  102.       /* Copy buffer and window local option values.  Not for a help buffer. */
  103.       buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
  104.       if (!buf->b_help)
  105. --- 1449,1472 ----
  106.   # endif
  107.          )
  108.   #endif
  109. +     {
  110.       enter_buffer(buf);
  111. + #ifdef FEAT_SYN_HL
  112. +     if (old_tw != curbuf->b_p_tw)
  113. +         check_colorcolumn(curwin);
  114. + #endif
  115. +     }
  116.   }
  117.   
  118.   /*
  119.    * Enter a new current buffer.
  120. !  * Old curbuf must have been abandoned already!  This also means "curbuf" may
  121. !  * be pointing to freed memory.
  122.    */
  123.       void
  124.   enter_buffer(buf)
  125.       buf_T    *buf;
  126.   {
  127.       /* Copy buffer and window local option values.  Not for a help buffer. */
  128.       buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
  129.       if (!buf->b_help)
  130. ***************
  131. *** 1468,1475 ****
  132.   
  133.   #ifdef FEAT_SYN_HL
  134.       curwin->w_s = &(buf->b_s);
  135. -     if (old_tw != buf->b_p_tw)
  136. -     check_colorcolumn(curwin);
  137.   #endif
  138.   
  139.       /* Cursor on first line by default. */
  140. --- 1490,1495 ----
  141. *** ../vim-7.3.821/src/version.c    2013-02-16 18:16:11.000000000 +0100
  142. --- src/version.c    2013-02-17 15:35:41.000000000 +0100
  143. ***************
  144. *** 727,728 ****
  145. --- 727,730 ----
  146.   {   /* Add new patch number below this line */
  147. + /**/
  148. +     822,
  149.   /**/
  150.  
  151. -- 
  152. Clothes make the man.  Naked people have little or no influence on society.
  153.                                -- Mark Twain (Samuel Clemens) (1835-1910)
  154.  
  155.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  156. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  157. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  158.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  159.