Mercurial > vim
comparison src/ex_docmd.c @ 10106:58e6dd1d8be3 v7.4.2324
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 4 19:50:54 2016 +0200
patch 7.4.2324
Problem: Crash when editing a new buffer and BufUnload autocommand wipes
out the new buffer. (Norio Takagi)
Solution: Don't allow wiping out this buffer. (partly by Hirohito Higashi)
Move old style test13 into test_autocmd. Avoid ml_get error when
editing a file.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 04 Sep 2016 20:00:07 +0200 |
parents | 7fc6103c6651 |
children | 4669440016f2 |
comparison
equal
deleted
inserted
replaced
10105:5aca505bbcfe | 10106:58e6dd1d8be3 |
---|---|
7199 #ifdef FEAT_AUTOCMD | 7199 #ifdef FEAT_AUTOCMD |
7200 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); | 7200 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); |
7201 /* Refuse to quit when locked or when the buffer in the last window is | 7201 /* Refuse to quit when locked or when the buffer in the last window is |
7202 * being closed (can only happen in autocommands). */ | 7202 * being closed (can only happen in autocommands). */ |
7203 if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1 | 7203 if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1 |
7204 && wp->w_buffer->b_closing)) | 7204 && wp->w_buffer->b_locked > 0)) |
7205 return; | 7205 return; |
7206 #endif | 7206 #endif |
7207 | 7207 |
7208 #ifdef FEAT_NETBEANS_INTG | 7208 #ifdef FEAT_NETBEANS_INTG |
7209 netbeansForcedQuit = eap->forceit; | 7209 netbeansForcedQuit = eap->forceit; |
7281 } | 7281 } |
7282 #ifdef FEAT_AUTOCMD | 7282 #ifdef FEAT_AUTOCMD |
7283 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); | 7283 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); |
7284 /* Refuse to quit when locked or when the buffer in the last window is | 7284 /* Refuse to quit when locked or when the buffer in the last window is |
7285 * being closed (can only happen in autocommands). */ | 7285 * being closed (can only happen in autocommands). */ |
7286 if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) | 7286 if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) |
7287 return; | 7287 return; |
7288 #endif | 7288 #endif |
7289 | 7289 |
7290 exiting = TRUE; | 7290 exiting = TRUE; |
7291 if (eap->forceit || !check_changed_any(FALSE, FALSE)) | 7291 if (eap->forceit || !check_changed_any(FALSE, FALSE)) |
7663 } | 7663 } |
7664 #ifdef FEAT_AUTOCMD | 7664 #ifdef FEAT_AUTOCMD |
7665 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); | 7665 apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); |
7666 /* Refuse to quit when locked or when the buffer in the last window is | 7666 /* Refuse to quit when locked or when the buffer in the last window is |
7667 * being closed (can only happen in autocommands). */ | 7667 * being closed (can only happen in autocommands). */ |
7668 if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) | 7668 if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) |
7669 return; | 7669 return; |
7670 #endif | 7670 #endif |
7671 | 7671 |
7672 /* | 7672 /* |
7673 * if more files or windows we won't exit | 7673 * if more files or windows we won't exit |