]> granicus.if.org Git - vim/commitdiff
patch 7.4.2130 v7.4.2130
authorBram Moolenaar <Bram@vim.org>
Sat, 30 Jul 2016 20:47:56 +0000 (22:47 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 30 Jul 2016 20:47:56 +0000 (22:47 +0200)
Problem:    Pending timers cause false memory leak reports.
Solution:   Free all timers on exit.

src/ex_cmds2.c
src/misc2.c
src/proto/ex_cmds2.pro
src/version.c

index ec9f50a527f67932a9c2ec8c946ff477c81f5954..2cebbebca880727ddf66461a3fd03208fbabd909 100644 (file)
@@ -1279,6 +1279,21 @@ set_ref_in_timer(int copyID)
     }
     return abort;
 }
+
+#  if defined(EXITFREE) || defined(PROTO)
+    void
+timer_free_all()
+{
+    timer_T *timer;
+
+    while (first_timer != NULL)
+    {
+       timer = first_timer;
+       remove_timer(timer);
+       free_timer(timer);
+    }
+}
+#  endif
 # endif
 
 #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT)
index 281f4af1acd66d6d256d37d59c2b276b7a375af3..53469a261f8447169f24c1c48f344e1b6e1838d1 100644 (file)
@@ -1224,6 +1224,9 @@ free_all_mem(void)
     channel_free_all();
     job_free_all();
 # endif
+#ifdef FEAT_TIMERS
+    timer_free_all();
+#endif
 
     free_termoptions();
 
index 8d9b72a24817cfbeb2221b9e1493ab3a37155ed5..c7a860b9f0a5660c9d0aa971cbc5aa918675ec55 100644 (file)
@@ -18,11 +18,12 @@ float_T profile_float(proftime_T *tm);
 void profile_setlimit(long msec, proftime_T *tm);
 int profile_passed_limit(proftime_T *tm);
 void profile_zero(proftime_T *tm);
-timer_T *create_timer(long msec, int repeats);
+timer_T *create_timer(long msec, int repeat);
 long check_due_timer(void);
 timer_T *find_timer(int id);
 void stop_timer(timer_T *timer);
 int set_ref_in_timer(int copyID);
+void timer_free_all(void);
 void profile_divide(proftime_T *tm, int count, proftime_T *tm2);
 void profile_add(proftime_T *tm, proftime_T *tm2);
 void profile_self(proftime_T *self, proftime_T *total, proftime_T *children);
index 90953555f89f45fe46ece3017dd1cd0390735e46..77a43c1be30ab2f15c8209e5ab72158b9985057f 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2130,
 /**/
     2129,
 /**/