diff src/window.c @ 30695:b9cc46461994 v9.0.0682

patch 9.0.0682: crash when popup with deleted timer is closed Commit: https://github.com/vim/vim/commit/cf3d0eaf47a56a52b355d8faf4e59685396f9c05 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 7 11:20:29 2022 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Fri, 07 Oct 2022 12:30:07 +0200
parents 15ac28c12c8f
children c7983f593fa7
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -5322,7 +5322,8 @@ win_free_popup(win_T *win)
 	    close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
     }
 # if defined(FEAT_TIMERS)
-    if (win->w_popup_timer != NULL)
+    // the timer may have been cleared, making the pointer invalid
+    if (timer_valid(win->w_popup_timer))
 	stop_timer(win->w_popup_timer);
 # endif
     vim_free(win->w_frame);