[gtksourceview] vim: be more defensive against dispose
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: be more defensive against dispose
- Date: Tue, 19 Apr 2022 23:43:41 +0000 (UTC)
commit 91cbc9e3e23afa35d525785a6e27ad597a8e1df0
Author: Christian Hergert <chergert redhat com>
Date: Tue Apr 19 16:43:36 2022 -0700
vim: be more defensive against dispose
If we dispose during insert, we might be able to hit this path. So ensure
that we avoid any changes here that could be effected by that.
gtksourceview/vim/gtksourcevimnormal.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/gtksourceview/vim/gtksourcevimnormal.c b/gtksourceview/vim/gtksourcevimnormal.c
index 81a716d4..54cd61f3 100644
--- a/gtksourceview/vim/gtksourcevimnormal.c
+++ b/gtksourceview/vim/gtksourcevimnormal.c
@@ -1516,11 +1516,18 @@ gtk_source_vim_normal_clear (GtkSourceVimNormal *self)
self->has_count = FALSE;
self->change_modifier = CHANGE_NONE;
- g_string_truncate (self->command_text, 0);
-
- /* Let the toplevel know we're back at steady state. This is
- * basically just so observers can watch keys which makes it
- * much easier to debug issues.
- */
- gtk_source_vim_normal_emit_ready (self);
+ /* If self->command_text == NULL, then we've disposed and we
+ * don't want to notify anything (as they should be disconnected
+ * anyway as part of g_object_run_dispose() process.
+ */
+ if (self->command_text != NULL)
+ {
+ g_string_truncate (self->command_text, 0);
+
+ /* Let the toplevel know we're back at steady state. This is
+ * basically just so observers can watch keys which makes it
+ * much easier to debug issues.
+ */
+ gtk_source_vim_normal_emit_ready (self);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]