[evolution] EHTMLEditorView - Avoid crash under force_spell_check_on_timeout()



commit 79cbbb2b1c1803640c382253191f1d83a37a81ab
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 a804c87..3bcc985 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -2708,9 +2708,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);
@@ -3589,6 +3588,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]