summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-26 21:33:04 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-26 21:33:04 +0100
commit0f618386367ba9388e1f50bc665bc1add6c01567 (patch)
tree577ff6e6e4901d1a7e988d16db0c22d74c404866 /src
parent58dcbf1c6586d3873702e035b47829178a91250e (diff)
patch 9.0.0282: a nested timout stops the previous timeoutv9.0.0282
Problem: A nested timout stops the previous timeout. Solution: Ignore any nested timeout.
Diffstat (limited to 'src')
-rw-r--r--src/evalfunc.c3
-rw-r--r--src/regexp.c21
-rw-r--r--src/version.c2
3 files changed, 22 insertions, 4 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a5f9ee359e..d2cc8fc769 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -9176,7 +9176,8 @@ do_searchpair(
theend:
#ifdef FEAT_RELTIME
- disable_regexp_timeout();
+ if (time_limit > 0)
+ disable_regexp_timeout();
#endif
vim_free(pat2);
vim_free(pat3);
diff --git a/src/regexp.c b/src/regexp.c
index bec046437f..8e6e9c4405 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -51,17 +51,32 @@ toggle_Magic(int x)
}
#ifdef FEAT_RELTIME
+static int timeout_nesting = 0;
+
+/*
+ * Start a timer that will cause the regexp to abort after "msec".
+ * This doesn't work well recursively. In case it happens anyway, the first
+ * set timeout will prevail, nested ones are ignored.
+ * The caller must make sure there is a matching disable_regexp_timeout() call!
+ */
void
init_regexp_timeout(long msec)
{
- timeout_flag = start_timeout(msec);
+ if (timeout_nesting == 0)
+ timeout_flag = start_timeout(msec);
+ ++timeout_nesting;
}
void
disable_regexp_timeout(void)
{
- stop_timeout();
- timeout_flag = &dummy_timeout_flag;
+ if (timeout_nesting == 0)
+ iemsg("disable_regexp_timeout() called without active timer");
+ else if (--timeout_nesting == 0)
+ {
+ stop_timeout();
+ timeout_flag = &dummy_timeout_flag;
+ }
}
#endif
diff --git a/src/version.c b/src/version.c
index ae33d6dac3..2eb817cf9d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -708,6 +708,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 282,
+/**/
281,
/**/
280,