summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-06-09 21:43:39 +0200
committerAlbert Cervin <albert@acervin.com>2024-06-09 21:45:36 +0200
commit67271d056409ce3727c282968a7186088bf19a28 (patch)
treea5fb74039cb5f2f35f987266ac233de4d0cea24a
parentb9fa579d78f4f2de8ea3d646488c6febffe2c127 (diff)
downloaddged-67271d056409ce3727c282968a7186088bf19a28.tar.gz
dged-67271d056409ce3727c282968a7186088bf19a28.tar.xz
dged-67271d056409ce3727c282968a7186088bf19a28.zip
Fix crash in completion
The crash happened when a new file was opened followed by another completion. The reason was that not accepting any of the completion suggestions caused the completion to stay active, causing the context to not be updated for the next completion.
-rw-r--r--src/main/completion.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/completion.c b/src/main/completion.c
index b2170e7..52bf6f8 100644
--- a/src/main/completion.c
+++ b/src/main/completion.c
@@ -379,6 +379,11 @@ bool completion_active() {
static void cleanup_active_comp_ctx(void *userdata) {
struct active_completion_ctx *ctx = (struct active_completion_ctx *)userdata;
+
+ if (g_state.ctx == ctx && g_state.active) {
+ abort_completion();
+ }
+
free(ctx->providers);
free(ctx);
}