[evolution/gnome-3-16] Fix regressions after "Fix various leaks of WebKit DOM objects"



commit e290f92612e6b13e43c3ceb1005f135951a42a48
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Mar 25 15:39:50 2015 +0100

    Fix regressions after "Fix various leaks of WebKit DOM objects"

 e-util/e-html-editor-selection.c |   17 ++++++++---------
 e-util/e-html-editor-view.c      |    2 +-
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 5d6808a..7e5c88f 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -111,7 +111,6 @@ static WebKitDOMRange *
 html_editor_selection_get_current_range (EHTMLEditorSelection *selection)
 {
        EHTMLEditorView *view;
-       WebKitWebView *web_view;
        WebKitDOMDocument *document;
        WebKitDOMDOMWindow *dom_window;
        WebKitDOMDOMSelection *dom_selection;
@@ -120,26 +119,26 @@ html_editor_selection_get_current_range (EHTMLEditorSelection *selection)
        view = e_html_editor_selection_ref_html_editor_view (selection);
        g_return_val_if_fail (view != NULL, NULL);
 
-       web_view = WEBKIT_WEB_VIEW (view);
-
-       document = webkit_web_view_get_dom_document (web_view);
+       document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
        dom_window = webkit_dom_document_get_default_view (document);
        if (!dom_window)
-               goto exit;
+               return NULL;
 
        dom_selection = webkit_dom_dom_window_get_selection (dom_window);
-       if (!WEBKIT_DOM_IS_DOM_SELECTION (dom_selection))
-               goto exit;
+       if (!dom_selection) {
+               g_object_unref (dom_window);
+               return NULL;
+       }
 
-       if (webkit_dom_dom_selection_get_range_count (dom_selection) < 1)
+       if (webkit_dom_dom_selection_get_range_count (dom_selection) < 1) {
                goto exit;
+       }
 
        range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
 
  exit:
        g_object_unref (dom_selection);
        g_object_unref (dom_window);
-       g_object_unref (view);
 
        return range;
 }
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 692c1dc..d115487 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -489,7 +489,7 @@ perform_spell_check (WebKitDOMDOMSelection *dom_selection,
                actual = webkit_dom_dom_selection_get_range_at (
                        dom_selection, 0, NULL);
        }
-       g_object_unref (actual);
+       g_clear_object (&actual);
 }
 
 void


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