1
0
forked from aniani/vim

patch 9.0.0682: crash when popup with deleted timer is closed

Problem:    Crash when popup with deleted timer is closed. (Igbanam
            Ogbuluijah)
Solution:   Check the timer still exists. (closes #11301)
This commit is contained in:
Bram Moolenaar
2022-10-07 11:20:29 +01:00
parent 0937b9fb24
commit cf3d0eaf47
5 changed files with 34 additions and 4 deletions

View File

@@ -777,15 +777,27 @@ set_ref_in_timer(int copyID)
return abort;
}
/*
* Return TRUE if "timer" exists in the list of timers.
*/
int
timer_valid(timer_T *timer)
{
if (timer == NULL)
return FALSE;
for (timer_T *t = first_timer; t != NULL; t = t->tr_next)
if (t == timer)
return TRUE;
return FALSE;
}
# if defined(EXITFREE) || defined(PROTO)
void
timer_free_all()
{
timer_T *timer;
while (first_timer != NULL)
{
timer = first_timer;
timer_T *timer = first_timer;
remove_timer(timer);
free_timer(timer);
}