summaryrefslogtreecommitdiffstats
path: root/src/web-view.c
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-31 05:12:23 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-31 05:12:23 (EDT)
commit1582f0c7dcac898cbebda188c86071bcc32ecb03 (patch)
treef6a80208cda71ba267764957d6893c4b2d05aef8 /src/web-view.c
parent5ce1dbc18e02652a5f0cb186f1047c758e1ec7f3 (diff)
downloadmarquee-1582f0c7dcac898cbebda188c86071bcc32ecb03.zip
marquee-1582f0c7dcac898cbebda188c86071bcc32ecb03.tar.gz
marquee-1582f0c7dcac898cbebda188c86071bcc32ecb03.tar.bz2
MqWebView: Invalidate main resource data cache on load change
Otherwise, a connected source view will keep getting the data the first such view received, even after a load change. A better solution would be to cache a pointer to the main resource and check in mq_web_view_get_data() if the main resource's address has changed. But apparently WebKit reuses resource objects, so that doesn't work.
Diffstat (limited to 'src/web-view.c')
-rw-r--r--src/web-view.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 01800b8..67e71cd 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -60,6 +60,13 @@ struct _MqWebViewClass {
G_DEFINE_TYPE(MqWebView, mq_web_view, WEBKIT_TYPE_WEB_VIEW)
+static void
+load_changed_cb(MqWebView *web_view, WebKitLoadEvent G_GNUC_UNUSED load_event)
+{
+ g_free(web_view->data);
+ web_view->data = NULL;
+}
+
static gboolean
context_menu_cb(MqWebView *web_view, WebKitContextMenu *context_menu,
GdkEvent *event, WebKitHitTestResult *hit_test_result)
@@ -325,6 +332,8 @@ mq_web_view_class_init(MqWebViewClass *klass)
static void
mq_web_view_init(MqWebView *web_view)
{
+ g_signal_connect(web_view, "load-changed",
+ G_CALLBACK(load_changed_cb), NULL);
g_signal_connect(web_view, "context-menu",
G_CALLBACK(context_menu_cb), NULL);
g_signal_connect(web_view, "notify::uri",