[evolution] Fix occasional runtime warning from e_web_extension_set_clipboard_flags()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Fix occasional runtime warning from e_web_extension_set_clipboard_flags()
- Date: Fri, 28 Apr 2017 09:00:36 +0000 (UTC)
commit dac6aca15d27b20d00c138c0baee745d9865214d
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 28 10:57:21 2017 +0200
Fix occasional runtime warning from e_web_extension_set_clipboard_flags()
The WebKitDOMDocument had not set page ID, because it had not been
loaded yet, thus the runtime check in e_web_extension_set_clipboard_flags()
failed, because the callback to "selection-changed" is registered
early. Either stop to claim and treat no page ID as a valid case,
or set page ID in web_page_created_cb() too. This does the later.
src/web-extensions/e-web-extension.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/web-extensions/e-web-extension.c b/src/web-extensions/e-web-extension.c
index 1d3254f..681e83a 100644
--- a/src/web-extensions/e-web-extension.c
+++ b/src/web-extensions/e-web-extension.c
@@ -1181,18 +1181,30 @@ web_page_send_request_cb (WebKitWebPage *web_page,
}
static void
-web_page_document_loaded_cb (WebKitWebPage *web_page,
- gpointer user_data)
+e_web_extension_store_page_id_on_document (WebKitWebPage *web_page)
{
WebKitDOMDocument *document;
guint64 *ppage_id;
- document = webkit_web_page_get_dom_document (web_page);
+ g_return_if_fail (WEBKIT_IS_WEB_PAGE (web_page));
ppage_id = g_new (guint64, 1);
*ppage_id = webkit_web_page_get_id (web_page);
+ document = webkit_web_page_get_dom_document (web_page);
+
g_object_set_data_full (G_OBJECT (document), WEB_EXTENSION_PAGE_ID_KEY, ppage_id, g_free);
+}
+
+static void
+web_page_document_loaded_cb (WebKitWebPage *web_page,
+ gpointer user_data)
+{
+ WebKitDOMDocument *document;
+
+ e_web_extension_store_page_id_on_document (web_page);
+
+ document = webkit_web_page_get_dom_document (web_page);
e_dom_utils_replace_local_image_links (document);
@@ -1282,6 +1294,8 @@ web_page_created_cb (WebKitWebExtension *wk_extension,
page_data->need_input = FALSE;
page_data->clipboard_flags = 0;
+ e_web_extension_store_page_id_on_document (web_page);
+
g_hash_table_insert (extension->priv->pages, ppage_id, page_data);
g_object_weak_ref (G_OBJECT (web_page), web_page_gone_cb, extension);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]