summaryrefslogtreecommitdiff
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2009-07-29 09:11:15 +0000
committerBram Moolenaar <Bram@vim.org>2009-07-29 09:11:15 +0000
commit9f8650c969f78833f2f053d037fc495ffb2c6888 (patch)
treed2630835b554b9f66cd5eb14b5e1905d4d869a1a /src/gui.c
parent6ec0a6c43da9b5241baa852968e8d76a9366905e (diff)
downloadvim-git-9f8650c969f78833f2f053d037fc495ffb2c6888.tar.gz
updated for version 7.2-240v7.2.240
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui.c b/src/gui.c
index e42cb4044..c25f760ea 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -5004,6 +5004,19 @@ gui_do_findrepl(flags, find_text, repl_text, down)
char_u *p;
regmatch_T regmatch;
int save_did_emsg = did_emsg;
+ static int busy = FALSE;
+
+ /* When the screen is being updated we should not change buffers and
+ * windows structures, it may cause freed memory to be used. Also don't
+ * do this recursively (pressing "Find" quickly several times. */
+ if (updating_screen || busy)
+ return FALSE;
+
+ /* refuse replace when text cannot be changed */
+ if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked())
+ return FALSE;
+
+ busy = TRUE;
ga_init2(&ga, 1, 100);
if (type == FRD_REPLACEALL)
@@ -5094,6 +5107,7 @@ gui_do_findrepl(flags, find_text, repl_text, down)
}
vim_free(ga.ga_data);
+ busy = FALSE;
return (ga.ga_len > 0);
}