[evolution/gnome-3-16] EHTMLEditorView - Avoid crash under force_spell_check_on_timeout()



commit 7364f4c6cd19cd33d40966917ce2fd6447c7ee87
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 21 08:02:43 2015 +0200

    EHTMLEditorView - Avoid crash under force_spell_check_on_timeout()
    
    The view could be freed within the second when the timeout was scheduled,
    thus when it was fired it used already freed structure.

 e-util/e-html-editor-view.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index d97bdef..4fee458 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -2701,9 +2701,8 @@ body_scroll_event_cb (WebKitDOMElement *element,
        if (!view->priv->inline_spelling)
                return;
 
-       if (view->priv->spell_check_on_scroll_event_source_id > 0) {
+       if (view->priv->spell_check_on_scroll_event_source_id > 0)
                g_source_remove (view->priv->spell_check_on_scroll_event_source_id);
-       }
 
        view->priv->spell_check_on_scroll_event_source_id =
                g_timeout_add (1000, (GSourceFunc)force_spell_check_on_timeout, view);
@@ -3573,6 +3572,11 @@ html_editor_view_dispose (GObject *object)
 
        g_clear_object (&priv->selection);
 
+       if (priv->spell_check_on_scroll_event_source_id > 0) {
+               g_source_remove (priv->spell_check_on_scroll_event_source_id);
+               priv->spell_check_on_scroll_event_source_id = 0;
+       }
+
        if (priv->aliasing_settings != NULL) {
                g_signal_handlers_disconnect_by_data (priv->aliasing_settings, object);
                g_object_unref (priv->aliasing_settings);


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