[gtksourceview/wip/chergert/vim: 221/363] give warning about double pushing state




commit fa622e7f5b529d842c993331ae7641a3c5eb6b73
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 15:25:35 2021 -0700

    give warning about double pushing state

 gtksourceview/vim/gtk-source-vim-state.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-state.c b/gtksourceview/vim/gtk-source-vim-state.c
index e39b1870..37970a47 100644
--- a/gtksourceview/vim/gtk-source-vim-state.c
+++ b/gtksourceview/vim/gtk-source-vim-state.c
@@ -445,6 +445,14 @@ gtk_source_vim_state_push (GtkSourceVimState *self,
        g_return_if_fail (GTK_SOURCE_IS_VIM_STATE (new_state));
        g_return_if_fail (gtk_source_vim_state_get_parent (new_state) == NULL);
 
+       if (priv->child != NULL)
+       {
+               g_warning ("Attempt to push state %s onto %s when it already has a %s",
+                          G_OBJECT_TYPE_NAME (new_state),
+                          G_OBJECT_TYPE_NAME (self),
+                          G_OBJECT_TYPE_NAME (priv->child));
+       }
+
        /* Associate the state with our view and set @self as parent to
         * hold the ref back to @self. We will not hold a reference to
         * @new_state to avoid a circular reference.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]