Mercurial > vim
comparison src/window.c @ 11800:5ceaecedbad2 v8.0.0782
patch 8.0.0782: using freed memory in quickfix code
commit https://github.com/vim/vim/commit/d28cc3f55d4a5a980f6ac6fa682382822a223720
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 27 22:03:50 2017 +0200
patch 8.0.0782: using freed memory in quickfix code
Problem: Using freed memory in quickfix code. (Dominique Pelle)
Solution: Handle a help window differently. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 27 Jul 2017 22:15:03 +0200 |
parents | c4e7fe672a72 |
children | bc0fee081e1e |
comparison
equal
deleted
inserted
replaced
11799:4614433e6af6 | 11800:5ceaecedbad2 |
---|---|
2312 if (close_last_window_tabpage(win, free_buf, prev_curtab)) | 2312 if (close_last_window_tabpage(win, free_buf, prev_curtab)) |
2313 return FAIL; | 2313 return FAIL; |
2314 | 2314 |
2315 /* When closing the help window, try restoring a snapshot after closing | 2315 /* When closing the help window, try restoring a snapshot after closing |
2316 * the window. Otherwise clear the snapshot, it's now invalid. */ | 2316 * the window. Otherwise clear the snapshot, it's now invalid. */ |
2317 if (win->w_buffer != NULL && win->w_buffer->b_help) | 2317 if (bt_help(win->w_buffer)) |
2318 help_window = TRUE; | 2318 help_window = TRUE; |
2319 else | 2319 else |
2320 clear_snapshot(curtab, SNAP_HELP_IDX); | 2320 clear_snapshot(curtab, SNAP_HELP_IDX); |
2321 | 2321 |
2322 #ifdef FEAT_AUTOCMD | 2322 #ifdef FEAT_AUTOCMD |
2395 | 2395 |
2396 if (only_one_window() && win_valid(win) && win->w_buffer == NULL | 2396 if (only_one_window() && win_valid(win) && win->w_buffer == NULL |
2397 && (last_window() || curtab != prev_curtab | 2397 && (last_window() || curtab != prev_curtab |
2398 || close_last_window_tabpage(win, free_buf, prev_curtab))) | 2398 || close_last_window_tabpage(win, free_buf, prev_curtab))) |
2399 { | 2399 { |
2400 /* Autocommands have close all windows, quit now. Restore | 2400 /* Autocommands have closed all windows, quit now. Restore |
2401 * curwin->w_buffer, otherwise writing viminfo may fail. */ | 2401 * curwin->w_buffer, otherwise writing viminfo may fail. */ |
2402 if (curwin->w_buffer == NULL) | 2402 if (curwin->w_buffer == NULL) |
2403 curwin->w_buffer = curbuf; | 2403 curwin->w_buffer = curbuf; |
2404 getout(0); | 2404 getout(0); |
2405 } | 2405 } |
6477 if (first_tabpage->tp_next != NULL) | 6477 if (first_tabpage->tp_next != NULL) |
6478 return FALSE; | 6478 return FALSE; |
6479 | 6479 |
6480 FOR_ALL_WINDOWS(wp) | 6480 FOR_ALL_WINDOWS(wp) |
6481 if (wp->w_buffer != NULL | 6481 if (wp->w_buffer != NULL |
6482 && (!((wp->w_buffer->b_help && !curbuf->b_help) | 6482 && (!((bt_help(wp->w_buffer) && !bt_help(curbuf)) |
6483 # ifdef FEAT_QUICKFIX | 6483 # ifdef FEAT_QUICKFIX |
6484 || wp->w_p_pvw | 6484 || wp->w_p_pvw |
6485 # endif | 6485 # endif |
6486 ) || wp == curwin) | 6486 ) || wp == curwin) |
6487 # ifdef FEAT_AUTOCMD | 6487 # ifdef FEAT_AUTOCMD |