Compare commits

...

4 Commits

Author SHA1 Message Date
Bram Moolenaar
11e79bb04e patch 8.0.0701: system test failing when using X11 forwarding
Problem:    System test failing when using X11 forwarding.
Solution:   Set $XAUTHORITY before changing $HOME. (closes #1812)
            Also use a better check for the exit value.
2017-07-08 17:03:21 +02:00
Bram Moolenaar
0ea5070d79 patch 8.0.0700: segfault with QuitPre autocommand closes the window
Problem:    Segfault with QuitPre autocommand closes the window. (Marek)
Solution:   Check that the window pointer is still valid. (Christian Brabandt,
            closes #1817)
2017-07-08 14:44:50 +02:00
Bram Moolenaar
710b4a1646 patch 8.0.0699: checksum tests are not actually run
Problem:    Checksum tests are not actually run.
Solution:   Add the tests to the list. (Dominique Pelle, closes #1819)
2017-07-08 14:29:19 +02:00
Bram Moolenaar
c4f833808a patch 8.0.0698: crash on exit when using Python function in timer.
Problem:    When a timer uses ":pyeval" or another Python command and it
            happens to be triggered while exiting a Crash may happen.
            (Ricky Zhou)
Solution:   Avoid running a Python command after python_end() was called.
            Do not trigger timers while exiting.  (closes #1824)
2017-07-07 14:50:44 +02:00
10 changed files with 55 additions and 7 deletions

View File

@@ -1183,6 +1183,7 @@ timer_callback(timer_T *timer)
/*
* Call timers that are due.
* Return the time in msec until the next timer is due.
* Returns -1 if there are no pending timers.
*/
long
check_due_timer(void)
@@ -1197,6 +1198,10 @@ check_due_timer(void)
# ifdef WIN3264
LARGE_INTEGER fr;
/* Don't run any timers while exiting. */
if (exiting)
return next_due;
QueryPerformanceFrequency(&fr);
# endif
profile_start(&now);

View File

@@ -7271,8 +7271,11 @@ ex_quit(exarg_T *eap)
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
/* Refuse to quit when locked or when the buffer in the last window is
* being closed (can only happen in autocommands). */
if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1
&& wp->w_buffer->b_locked > 0))
if (curbuf_locked()
# ifdef FEAT_WINDOWS
|| !win_valid(wp)
# endif
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
return;
#endif

View File

@@ -779,6 +779,7 @@ get_exceptions(void)
static int initialised = 0;
#define PYINITIALISED initialised
static int python_end_called = FALSE;
#define DESTRUCTOR_FINISH(self) self->ob_type->tp_free((PyObject*)self);
@@ -878,6 +879,7 @@ python_end(void)
if (recurse != 0)
return;
python_end_called = TRUE;
++recurse;
#ifdef DYNAMIC_PYTHON
@@ -1040,6 +1042,8 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg)
}
++recursive;
#endif
if (python_end_called)
return;
#if defined(MACOS) && !defined(MACOS_X_UNIX)
GetPort(&oldPort);
@@ -1568,7 +1572,7 @@ do_pyeval (char_u *str, typval_T *rettv)
(rangeinitializer) init_range_eval,
(runner) run_eval,
(void *) rettv);
switch(rettv->v_type)
switch (rettv->v_type)
{
case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break;

View File

@@ -733,8 +733,8 @@ get_py3_exceptions(void)
#endif /* DYNAMIC_PYTHON3 */
static int py3initialised = 0;
#define PYINITIALISED py3initialised
static int python_end_called = FALSE;
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self)
@@ -817,6 +817,7 @@ python3_end(void)
if (recurse != 0)
return;
python_end_called = TRUE;
++recurse;
#ifdef DYNAMIC_PYTHON3
@@ -938,6 +939,9 @@ DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg)
PyObject *cmdbytes;
PyGILState_STATE pygilstate;
if (python_end_called)
goto theend;
#if defined(MACOS) && !defined(MACOS_X_UNIX)
GetPort(&oldPort);
/* Check if the Python library is available */

View File

@@ -8,7 +8,11 @@ endif
" Only when the +eval feature is present.
if 1
" Make sure the .Xauthority file can be found after changing $HOME.
if $XAUTHORITY == ''
let $XAUTHORITY = $HOME . '/.Xauthority'
endif
" Make sure $HOME does not get read or written.
let $HOME = '/does/not/exist'
endif

View File

@@ -44,6 +44,7 @@ source test_reltime.vim
source test_searchpos.vim
source test_set.vim
source test_sort.vim
source test_sha256.vim
source test_statusline.vim
source test_syn_attr.vim
source test_tabline.vim

View File

@@ -12,3 +12,4 @@ source test_matchadd_conceal_utf8.vim
source test_regexp_utf8.vim
source test_source_utf8.vim
source test_utf8.vim
source test_utf8_comparisons.vim

View File

@@ -49,12 +49,12 @@ endfunction
function! Test_system_exmode()
if has('unix') " echo $? only works on Unix
let cmd = ' -es -u NONE -c "source Xscript" +q; echo $?'
let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"'
" Need to put this in a script, "catch" isn't found after an unknown
" function.
call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
let a = system(v:progpath . cmd)
call assert_equal('0', a[0])
call assert_match('result=0', a)
call assert_equal(0, v:shell_error)
endif

View File

@@ -473,5 +473,23 @@ func Test_tabnext_on_buf_unload2()
endwhile
endfunc
func Test_close_on_quitpre()
" This once caused a crash
new
only
set bufhidden=delete
au QuitPre <buffer> close
tabnew tab1
tabnew tab2
1tabn
q!
call assert_equal(1, tabpagenr())
call assert_equal(2, tabpagenr('$'))
" clean up
while tabpagenr('$') > 1
bwipe!
endwhile
1b
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -764,6 +764,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
701,
/**/
700,
/**/
699,
/**/
698,
/**/
697,
/**/