[gtksourceview] ContextEngine: avoid crash when closing a big file



commit 2e2e4b9f1ae413a6d95e7f14c5e35ef3f7249ef3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Oct 12 15:16:42 2013 +0200

    ContextEngine: avoid crash when closing a big file
    
    It seems that there exists a code path where the assertion fails.
    Ideally, this code path should be found, and the code must be fixed at
    the right place. But the ContextEngine is complex, so as a quick
    solution, it's better to make the code more robust than doing nothing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=605138

 gtksourceview/gtksourcecontextengine.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 5ad39ea..284c9c0 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -2663,8 +2663,18 @@ gtk_source_context_engine_finalize (GObject *object)
        g_assert (!ce->priv->tags);
        g_assert (!ce->priv->root_context);
        g_assert (!ce->priv->root_segment);
-       g_assert (!ce->priv->first_update);
-       g_assert (!ce->priv->incremental_update);
+
+       if (ce->priv->first_update != 0)
+       {
+               g_source_remove (ce->priv->first_update);
+               ce->priv->first_update = 0;
+       }
+
+       if (ce->priv->incremental_update != 0)
+       {
+               g_source_remove (ce->priv->incremental_update);
+               ce->priv->incremental_update = 0;
+       }
 
        _gtk_source_context_data_unref (ce->priv->ctx_data);
 


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